Next.js Discord

Discord Forum

Server responds in development but not in production

Answered
Silver Fox posted this in #help-forum
Open in Discord
Avatar
Silver FoxOP
title.
Answered by joulev & fuma pray for Schneider
write then use a database or vercel kv
View full answer

24 Replies

Avatar
Silver FoxOP
Image
Image
basically the server is not working
im getting errors status 500
Avatar
joulev & fuma pray for Schneider
something should show up in the log
go to deployment => log
Avatar
Silver FoxOP
ok
Avatar
joulev & fuma pray for Schneider
fix it
most likely an env var issue
Avatar
Silver FoxOP
- error [Error: ENOENT: no such file or directory, open 'app/api/storage/servers.json'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'app/api/storage/servers.json'
}

I need to redo the paths?
what should I keep the paths as?
Avatar
joulev & fuma pray for Schneider
the problem is that fs doesn't work on vercel because vercel is serverless
since it's json already i'd just import it
Avatar
Silver FoxOP
I need to write too
Avatar
joulev & fuma pray for Schneider
import data from "./path/to/data.json"
Avatar
joulev & fuma pray for Schneider
write then use a database or vercel kv
Answer
Avatar
Silver FoxOP
any other hosting which work with fs?
Avatar
joulev & fuma pray for Schneider
any server-ful hosting will work with fs
your private server, digital ocean, render, fly.io, railway, etc
but they are not free
conventional hosting is always more expensive than serverless
Avatar
Silver FoxOP
:((
Ill have to rewrite my backend
Avatar
Silver FoxOP
time to setup firebase