POSTGRES_URI is required during build time when using with next-auth/beta ?

So I have this simple google auth build with next-auth + drizzle orm pg adapter. for testing purposes, currently there's only /api/auth/[...nextauth]/route.ts and auth.js for simple authentication This cause ERR_INVALID_URL that came from DrizzleAdapterto be thrown during npm run build Even though it can be change again during run-time, it just very annoying to have to inject this variable in during build process. Anyone have any solution or workaround that does not require setting POSTGRES_URI during build-time and changing it again ? thank you.
// route.ts
export { GET, POST } from "@/auth";
// route.ts
export { GET, POST } from "@/auth";
// auth.js
import { DrizzleAdapter } from "@auth/drizzle-adapter";
import { db } from "@/lib/db/clients";
import NextAuth from "next-auth";
import Google from "next-auth/providers/google";

export const {
handlers: { GET, POST },
auth,
} = NextAuth({
adapter: DrizzleAdapter(db),
session: {
strategy: "database",
},
providers: [Google],
});
// auth.js
import { DrizzleAdapter } from "@auth/drizzle-adapter";
import { db } from "@/lib/db/clients";
import NextAuth from "next-auth";
import Google from "next-auth/providers/google";

export const {
handlers: { GET, POST },
auth,
} = NextAuth({
adapter: DrizzleAdapter(db),
session: {
strategy: "database",
},
providers: [Google],
});
1 Reply
hazamashoken
hazamashokenOP9mo ago
bump
Want results from more Discord servers?
Add your server