# Lazy database open Opening SQLite at module import time broke `npm run build` with "database is locked": Next collects page data in parallel workers, each importing the module and running DDL at once. The fix is a bound Proxy. Nothing opens until a property is first touched; then `DatabaseSync` is constructed, `journal_mode = WAL` and `busy_timeout = 5000` are set, and the schema DDL runs once. The Proxy methods are bound to the real instance — an unbound Proxy made every call fail with "TypeError: Illegal invocation". A second trap: SQLite rows arrive as null-prototype objects, which Next refuses to serialize from a server component to a client component. Rows are normalised on read. Related: [[SQLite schema]], [[Running locally]].