Self hosted nextjs api route crashes when reverse proxying with ssl
Answered
Tomistoma posted this in #help-forum
TomistomaOP
I'm trying to self host a nextjs app on a ubuntu server. Which works fine, except for when I try to make an api call...
When I build and run the app using pnpm run build and pnpm run start, it fires up the application. I can go make my api call, and everything works...
This is running on port 3000...
Now when I add caddy to the mix, a webserver that can serve as a reverse proxy with automatic SSL, it is causing issues when I try to make that same api call...
The caddy logs only tell me that the api route returns with a 502, without any description, and I see the server that was running it close out of the nextjs shell.
What can I do to diagnose this issue? Because console logging anything also doesn't seem to help.
When I build and run the app using pnpm run build and pnpm run start, it fires up the application. I can go make my api call, and everything works...
This is running on port 3000...
Now when I add caddy to the mix, a webserver that can serve as a reverse proxy with automatic SSL, it is causing issues when I try to make that same api call...
The caddy logs only tell me that the api route returns with a 502, without any description, and I see the server that was running it close out of the nextjs shell.
What can I do to diagnose this issue? Because console logging anything also doesn't seem to help.
Answered by Tomistoma
I figured out the issue, the server went out of ram and didn't have a swap file
2 Replies
TomistomaOP
I'm also getting a:  ELIFECYCLE  Command failed with exit code 137
TomistomaOP
I figured out the issue, the server went out of ram and didn't have a swap file
Answer