fix build error

This commit is contained in:
dohsimpson
2025-02-18 23:59:41 -05:00
parent 8ac2ec053d
commit b7933ea040
3 changed files with 24 additions and 17 deletions

View File

@@ -1,5 +1,3 @@
import '@/lib/env.server' // startup env var check
import './globals.css' import './globals.css'
import { Inter } from 'next/font/google' import { Inter } from 'next/font/google'
import { DM_Sans } from 'next/font/google' import { DM_Sans } from 'next/font/google'

7
instrumentation.ts Normal file
View File

@@ -0,0 +1,7 @@
import { init } from '@/lib/env.server' // startup env var check
export function register() {
if (typeof window === "undefined") {
init()
}
}

View File

@@ -12,9 +12,10 @@ declare global {
} }
} }
try { export function init() {
try {
zodEnv.parse(process.env) zodEnv.parse(process.env)
} catch (err) { } catch (err) {
if (err instanceof z.ZodError) { if (err instanceof z.ZodError) {
const { fieldErrors } = err.flatten() const { fieldErrors } = err.flatten()
const errorMessage = Object.entries(fieldErrors) const errorMessage = Object.entries(fieldErrors)
@@ -28,4 +29,5 @@ try {
) )
process.exit(1) process.exit(1)
} }
}
} }