fix: wrap isSignupDisabled in try/catch
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user