App Platform and SQLIte

I’m running into an issue trying to use SQLite as a cache for my Nextjs app. It’s needed because Nextjs builds each page in a worker, so data that needs to be shared is writing to a SQLite db in <root>/data/cache.sqlite3. This cache is recreated during the build step, so it’s ok for it to be ephemeral. This works great in development but I’m running into this error when trying to access it once deployed to App Platform:

frontend | 20:59:23 > Build error occurred
frontend | 20:59:23 [Error: SQLITE_IOERR: disk I/O error] {
frontend | 20:59:23   type: 'Error',
frontend | 20:59:23   errno: 10,
frontend | 20:59:23   code: 'SQLITE_IOERR'
frontend | 20:59:23 }

Is there a preferred directory for temp files on App Platform? What could be going on here?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

So this turned out to be an issue with too many writes occurring at once. I fixed this by adding some backoff + retry logic around those writes, which resolved the issue.