Skip to content

fix(content): store the sqlite database in /tmp - #251

Merged
kashalls merged 1 commit into
mainfrom
kashall/database-file-access-error-65c30f
Oct 10, 2026
Merged

kashalls merged 1 commit into
mainfrom
kashall/database-file-access-error-65c30f

Conversation

@kashalls

Copy link
Copy Markdown
Owner

What

Set content.database to { type: 'sqlite', filename: '/tmp/contents.sqlite' } in nuxt.config.ts.

Why

In production every /__nuxt_content/blog/query request returned 500 with unable to open database file (ERR_SQLITE_ERROR, errcode 14). The blog's runtime queries were all failing.

With the node-server preset, Nuxt Content 3.16.1 defaults the runtime database to ./contents.sqlite, which resolves against the cwd (/app). That path can't be written in production:

  • the distroless image runs as nonroot, but /app is owned by root
  • the ok8-sh deployment sets readOnlyRootFilesystem: true, and its only writable mount is the /tmp emptyDir

The database is restored from the bundled dump at startup, so it doesn't need to persist. /tmp is enough.

Testing

  • Built with NITRO_PRESET=node-server and ran .output/server/index.mjs from /, where the user can't write.
  • Startup logged no SQL errors and created /tmp/contents.sqlite.
  • A _content_blog query returned [{"path":"/blog/hello-world"}].
  • No container runtime was available, so I haven't run the real image (uid 65532, read-only root). That needs a deploy to the cluster.

馃 Generated with Claude Code

Nuxt Content restores its bundled dump to ./contents.sqlite at startup,
which resolves against /app. The runtime image runs as nonroot and the
deployment uses a read-only root filesystem, so the file could not be
created and every content query returned 500. /tmp is the writable
emptyDir mount.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jordan Jones <git@svcs.ok8.sh>
@kashalls
kashalls merged commit 7334da1 into main Oct 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant