Changeset 5f43245 in Klonkt


Ignore:
Timestamp:
06/16/2026 04:05:27 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
a742e9f
Parents:
00d54bc
Message:

Fix: fresh install crashes on first boot (sessions table doesn't exist yet)

initializeDatabase() was called AFTER the session-store constructor, but
SqliteSessionStore queries the sessions table during construction. On a
fresh DB (new self-host/instance) that table didn't exist yet ->
"no such table: sessions" -> crash-loop on the very first boot. Existing
instances already had their schema, so this went unnoticed.

initializeDatabase() is now moved to before the session middleware.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/server.js

    r00d54bc r5f43245  
    125125if (!isDev) app.set('trust proxy', 1);
    126126
     127// Schema aanmaken/bijwerken VÓÓR iets de DB aanraakt: de session-store doet
     128// bij constructie al een query op de `sessions`-tabel, dus bij een verse
     129// install moeten de tabellen eerst bestaan (anders: "no such table: sessions"
     130// → crash-loop op de allereerste boot).
     131initializeDatabase();
     132
    127133// Session middleware extracted into a variable so the WebSocket upgrade
    128134// handler can reuse it (it needs req.session to authenticate sockets).
     
    147153// (Verwijderd) TWA / digital-asset-links — alleen nodig voor de APK/TWA-variant.
    148154// Klonkt is PWA-only; geen assetlinks.json meer.
    149 
    150 initializeDatabase();
    151155
    152156// Cirkels: periodieke achtergrond-sync van remote instances (no-op tenzij tenancy='circle').
Note: See TracChangeset for help on using the changeset viewer.