diff --git a/apps/server/src/share/routes.ts b/apps/server/src/share/routes.ts index 6c41d368de..6494f099a7 100644 --- a/apps/server/src/share/routes.ts +++ b/apps/server/src/share/routes.ts @@ -123,6 +123,13 @@ function render404(res: Response) { } function register(router: Router) { + // Guard: if the share DB is not yet initialized, return 503 for all /share routes. + router.use((_req: Request, res: Response, next) => { + if (!assertShareDbReady(res)) { + return; + } + next(); + }); function renderNote(note: SNote, req: Request, res: Response) { if (!note) {