diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts index cab4d1ed50..1d4b84204e 100644 --- a/apps/web/middleware.ts +++ b/apps/web/middleware.ts @@ -61,10 +61,14 @@ const middleware = async (req: NextRequest): Promise> => { } if (url.pathname.startsWith("/api/auth/signup")) { - const isSignupDisabled = await get("isSignupDisabled"); - // If is in maintenance mode, point the url pathname to the maintenance page - if (isSignupDisabled) { - return NextResponse.json({ error: "Signup is disabled" }, { status: 503 }); + try { + const isSignupDisabled = await get("isSignupDisabled"); + // If is in maintenance mode, point the url pathname to the maintenance page + if (isSignupDisabled) { + return NextResponse.json({ error: "Signup is disabled" }, { status: 503 }); + } + } catch (error) { + // Don't crash if EDGE_CONFIG env var is missing } }