Skip to content

When using the SQLitecache, must I ensure the machine is a primary? #1039

@kentcdodds

Description

@kentcdodds

Discussed in #1038

Originally posted by warronbebster September 4, 2025
I've followed the caching docs and when I run it in production, I get Disk I/O SQLite errors:

2025-09-04T19:33:55Z app[784049ef491948] iad [info]level=INFO msg="fuse: write(): wal error: read only replica"
error setting cache: challenge:mallorca-championships-presented-by-ecotrans-group-2025-served-2025 Error: disk I/O error
2025-09-04T19:33:55Z app[784049ef491948] iad [info]    at Object.set (file:///myapp/app/utils/cache.server.ts:154:16)
2025-09-04T19:33:55Z app[784049ef491948] iad [info]    at getFreshValue (file:///myapp/node_modules/@epic-web/cachified/src/getFreshValue.ts:65:19)
2025-09-04T19:33:55Z app[784049ef491948] iad [info]    at cachified (file:///myapp/node_modules/@epic-web/cachified/src/cachified.ts:94:17)
2025-09-04T19:33:55Z app[784049ef491948] iad [info]    at getChallenge (file:///myapp/app/utils/challenge.server.ts:32:18)
2025-09-04T19:33:55Z app[784049ef491948] iad [info]    at getTournamentContextMain (file:///myapp/app/utils/tournament-context.server.ts:60:18)
2025-09-04T19:33:55Z app[784049ef491948] iad [info]    at loader$9 (file:///myapp/app/routes/tournaments+/$slug+/$tour+/index.tsx:38:9)
2025-09-04T19:33:55Z app[784049ef491948] iad [info]    at callRouteHandler (file:///myapp/node_modules/react-router/dist/development/chunk-5UALIXAM.mjs:509:16)
2025-09-04T19:33:55Z app[784049ef491948] iad [info]    at commonRoute.loader (file:///myapp/node_modules/react-router/dist/development/chunk-5UALIXAM.mjs:658:19)
2025-09-04T19:33:55Z app[784049ef491948] iad [info]    at file:///myapp/node_modules/react-router/dist/development/chunk-PVWAREVJ.mjs:4259:19
2025-09-04T19:33:55Z app[784049ef491948] iad [info]    at callLoaderOrAction (file:///myapp/node_modules/react-router/dist/development/chunk-PVWAREVJ.mjs:4311:16) {
2025-09-04T19:33:55Z app[784049ef491948] iad [info]  code: 'ERR_SQLITE_ERROR',
2025-09-04T19:33:55Z app[784049ef491948] iad [info]  errcode: 778,
2025-09-04T19:33:55Z app[784049ef491948] iad [info]  errstr: 'disk I/O error'
2025-09-04T19:33:55Z app[784049ef491948] iad [info]}

To use the SQLite cache, do we have to first use ensurePrimary() before saving to it? If so, can the docs be updated to reflect that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions