fix(auth): detect CI build when either Neon Auth var is missing
Deploy to route.crispygoat.com / deploy (push) Successful in 3m28s

This commit is contained in:
openclaw
2026-06-09 12:57:52 -06:00
parent 044ac6cd32
commit 4253544109
+5 -5
View File
@@ -29,10 +29,10 @@ export function getNeonAuthConfig(): NeonAuthBaseConfig {
const baseUrl = process.env.NEON_AUTH_BASE_URL || ""; const baseUrl = process.env.NEON_AUTH_BASE_URL || "";
const cookieSecret = process.env.NEON_AUTH_COOKIE_SECRET || ""; const cookieSecret = process.env.NEON_AUTH_COOKIE_SECRET || "";
// Detect CI build context: DATABASE_URL is set (Build step), NEON_AUTH_BASE_URL is empty. // Detect CI build context: DATABASE_URL is set (Build step), but one or both Neon Auth
// In this case, return a placeholder so `next build` succeeds — auth will be validated // vars are empty. Return a placeholder so `next build` succeeds — auth is validated
// at runtime when actually needed. // at runtime when actually needed.
const isCIBuild = !!process.env.DATABASE_URL && !baseUrl; const isCIBuild = !!process.env.DATABASE_URL && (!baseUrl || !cookieSecret);
if (!baseUrl || baseUrl === "placeholder") { if (!baseUrl || baseUrl === "placeholder") {
if (isCIBuild) { if (isCIBuild) {
@@ -64,8 +64,8 @@ export function getNeonAuthConfig(): NeonAuthBaseConfig {
* Use this for middleware that should gracefully degrade if auth is not set up. * Use this for middleware that should gracefully degrade if auth is not set up.
*/ */
export function getNeonAuthConfigOptional(): NeonAuthBaseConfig | null { export function getNeonAuthConfigOptional(): NeonAuthBaseConfig | null {
const baseUrl = process.env.NEON_AUTH_BASE_URL; const baseUrl = process.env.NEON_AUTH_BASE_URL || "";
const cookieSecret = process.env.NEON_AUTH_COOKIE_SECRET; const cookieSecret = process.env.NEON_AUTH_COOKIE_SECRET || "";
if (!baseUrl || !cookieSecret || cookieSecret.length < 32) { if (!baseUrl || !cookieSecret || cookieSecret.length < 32) {
return null; return null;