phartenfeller / sveltekit-1.0-sqlite-demo-app

My demo app of various SvelteKit experiments from my YouTube series.
https://sveltekit-demo.hartenfeller.dev
106 stars 19 forks source link

directory cannot be found when building #2

Closed robthepaper closed 1 year ago

robthepaper commented 1 year ago

Hi, no problem in dev mode but when going in prod, the build gives error. I've tried different ways to get the path like : import path from 'path' const dbPath = path.join(process.cwd(), 'data', 'database.db') console.log('dbPath', dbPath)

but it still can't find the database, do you have a idea on how to make it work in production ?

robthepaper commented 1 year ago

This is the exact message when building in vercel

TypeError: Cannot open database because the directory does not exist

01:29:29.423 | at new Database (/vercel/path0/node_modules/.pnpm/better-sqlite3@8.1.0/node_modules/better-sqlite3/lib/database.js:59:9)

phartenfeller commented 1 year ago

Hi, if it works on your local machine it might be related to Vercel. I have close to 0 experience with Vercel.

robthepaper commented 1 year ago

Hi, thanks for your reply, indeed, I just read on vercel's website (https://vercel.com/guides/is-sqlite-supported-in-vercel) that it is not supported.