🚑 Middleware crash (#1567)

This commit is contained in:
Manuel
2023-11-09 20:23:53 +01:00
committed by GitHub
parent 67eaada59b
commit 82c79c6591

View File

@@ -1,5 +1,3 @@
import Consola from 'consola';
import fs from 'fs/promises';
import { NextRequest, NextResponse } from 'next/server';
import { getUrl } from './tools/server/url';
@@ -54,13 +52,6 @@ const shouldRedirectToOnboard = async (): Promise<boolean> => {
}
const fileUri = process.env.DATABASE_URL.substring(4);
try {
await fs.access(fileUri, fs.constants.W_OK);
return await cacheAndGetUserCount();
} catch {
Consola.warn(
`detected that the path ${fileUri} was not readable. Showing onboarding page for setup...`
);
return true;
}
return await cacheAndGetUserCount();
// TODO: Show an error page if the database file is read-only
};