diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 3eab008f8..540f62c67 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -40,3 +40,6 @@ export default function RootLayout({ ); } + +// Enable edge runtime but you are required to disable the `migrate` function in `src/libs/DB.ts` +// export const runtime = 'edge'; diff --git a/src/libs/DB.ts b/src/libs/DB.ts index bdac91aa8..4c76b651b 100644 --- a/src/libs/DB.ts +++ b/src/libs/DB.ts @@ -11,6 +11,7 @@ const client = createClient({ export const db = drizzle(client); +// Disable migrate function if using Edge runtime and use `npm run db:push` instead if (process.env.NODE_ENV !== 'production') { await migrate(db, { migrationsFolder: './migrations' }); } diff --git a/src/libs/Env.mjs b/src/libs/Env.mjs index 45c0f4915..19aca9551 100644 --- a/src/libs/Env.mjs +++ b/src/libs/Env.mjs @@ -1,6 +1,5 @@ /* eslint-disable import/prefer-default-export */ import { createEnv } from '@t3-oss/env-nextjs'; -import process from 'process'; import { z } from 'zod'; // Don't add NODE_ENV into T3 Env, it changes the tree-shaking behavior