Nextjs With better-sqlite3 , how to get access to the local db file?

Hello
I built an application in NEXTJS with better-sqlite3
There is a file called list.db which is in the main folder
When I run npm run dev or npm run build on my computer
Everything works without any problems and I have access to the file to retrieve information from it

I uploaded the project to GITHUB and did DEPLOY via NETLIFY
And NETLIFY does the BUILD and then I try to log in to ther website and get an ERROR 505 error and I also saw that the list.db file does not exist at all in the main folder
So I put it in the public folder and uploaded it again to GITHUB and did DEPLOY again and now the file does exist in the main folder but I still get the same error
Could it be that NETLIFY does not have access to the DB file? For some reason?

While there’s a way to get the local DB file, your end goal is not possible on Netlify. Next.js server side functionality is run on AWS Lambda which:

  • does not provide write access to disk (except for temp folder) - so you cannot actually write to the database unless you store it in /tmp
  • the storage is ephermal - so the database will be destroyed and reset back to the state you uploaded it in every now and then

I’d recommend using a cloud database.