Skip to content

Scheduling infrastructure for absolutely everyone.

fix: wrap isSignupDisabled in try/catch

Alex van Andel63f537a08f9b
diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts
index cab4d1ed50e..1d4b84204e2 100644
--- a/apps/web/middleware.ts
+++ b/apps/web/middleware.ts
@@ -61,10 +61,14 @@ const middleware = async (req: NextRequest): Promise<NextResponse<unknown>> => {
}
if (url.pathname.startsWith("/api/auth/signup")) {
- const isSignupDisabled = await get<boolean>("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<boolean>("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
}
}