Next.js project keeps deploying
Hi,
When I try to deploy my Next.js app it keeps deploying and I can't see the logs

118 Replies
You should be able to see logs in the deployments tab. There should be an active deployment from which you can see the logs.
Thank you very much, I see them now, I'll try to understand what is happening
If you attach the log I'll look over it, maybe can help
Thank you, in fact it stops at this step but on Vercel it works fine

Wait a little bit, atleast should give an error if something is wrong
Okey, there is a moment when DokPloy is freezing on the VPS (2vCore, 2Go RAM, 40Go SSD)
One hour till now nothing happened it's still on the same point

I think you're running out of memory unfortunately

That does not give the total for everything that happens
Dokploy cannot (currently) give you total used RAM on the system
If you SSH into the machine and run
journalctl -b 0 --grep "OOM"
, does it find anything?Thank you, I am actually logging into the VPS
give me a sec

The thing is that yes, it probably uses a lot of RAM at the begginning of the deployment
I've seen that also on Coolify with Next.js projects
What did
journalctl
say?
You added a s there
otherwise it's a lot of bruteforce from diffrent IPs
oh sorry didn't notice

Have you restarted the VPS since you last tried to deploy?
Yes but let's try it again
Aha. No need
Change the -b parameter to 1 if you only have restarted once

So, I am restarting
Didn't know this combo of commands very interesting
sudo journalctl -b 2 --grep "OOM"
I meant the parameter that is tied to -b

I am restarting the VPS

Didn't know this combo of commands but it's interesting
htop still give the same amount of RAM

But as I said it's not the first time I face a problem like this with nixpack, Coolify did it too, but on Coolify it rised an error 503 while deploying
Still on the same step after reloading

For a try can you disable the checking?
next.config.js: typescript | Next.js
Next.js reports TypeScript errors by default. Learn to opt-out of this behavior here.
debug purpose
Yeah let's try this

it worked directly
I have 2 nextjs projects, both of them will cause my 8GB ram VPS restart if I accidentally build it in Dokploy. This is known issue with Nextjs.
Oh but you see that it has builded fine when disabling Type checking
The linting part can be added separately if I'm not mistaken
it has directly build it and deployed it

Can you check htop when building?
I'm curious for the stats
I'm curious too, sorry for hijack topic π
This issue interest me a lot
no problem but actually I am not able to take a 8Go RAM VPS
only for 2 projects
yes, if you could solve this then we should put some notes around Dokplpy Docs, people asking this question A LOT
Ah that's nice, as I said I've faced that with Coolify but got no answer like in the DokPloy community
let's check the RAM in htop

after building
which is normal imo it has raised for about 100Mo
may I ask, where did you run htop?
The most interesting part is not giving any errors
Can you run npm run build locally?
If runs as expected
from the VPS, just installed it with apt then htop
first time I enjoy deploying my app on PaaS, with Coolify it started to be weired
you can play with the code https://github.com/rapidosaas/job-board-nextjs
GitHub
GitHub - rapidosaas/job-board-nextjs
Contribute to rapidosaas/job-board-nextjs development by creating an account on GitHub.
So, next step is to solve the type checking problem
A solution would be to have a dockerfile and use that for build
There you can run the lint before building
And disable from build
Can you share your vps
Which provider
Maybe I can check this too
Later
Of course, but I can check this I am here in the DokPloy community, I like the project and I like the used Stack, no needs to do a double job
this

And I have a second one that I will use to test DokPloy too
this one

They don't have hourly payment π¦
I'll check with same resources at other provider
Yeah but I am using it because it doesn't count the hours
Not a problem, I'm a nextjs developer as well so It would be good to resolve the problem before starting to use dokploy
Yeah I wonder if we can find an issue for this
I mean at hetzner if you use like for 1 hour don't cost your the full month
Ah okey, so I am here for that kind of VPS
I created a pull request for your repo
Merge it
And check linting without the config
this ?

Yes
okey let's try it
Seems like the build error occured due to sharp, don't know why, I think they added sharp as default in v15
Kawa Entertainment
YouTube
[FR][EN] - #livecoding
Ceci est mon message par defaut, si il est affichΓ© c'est que c'est un stream pour streamer jusqu'Γ ce que je donnes un sens Γ la vidΓ©os, amusez-vous bien !
This is my default message, if it is displayed it means that it's a stream to just stream until i give the video a sense, Have Fun !
unlisted video
if you can PR on the develop branch please
i don't know if I have created it yet π
It will not resolve the issue
Seems like you running out of memory
so you think it's the memory ? but the docs says that it's enugh 2vCore and 2Go RAM and when we disable the type checking it works perfectly
I would say nixpacks cache stuff doing something π
Tomorrow I'll create a dockerfile, let's try it with it
okey, let's also keep that package

Optimizing: Memory Usage | Next.js
Optimize memory used by your application in development and production.
if you have a change to do now you can PR on the develop branch π
so finally I have just ignored lint and it worked
https://nextjs.org/docs/app/api-reference/config/next-config-js/eslint
you can check this video
It's not a good practice to disable this step, but if you add npm run lint to your nixpacks config should do the job. Tomorrow I'll have more time to investigate this problem.
Introduction | Nixpacks
App source + Nix packages + Docker = Image
I'm not too familiar with nixpacks either
Thank you very much for your help
for the moment I will do liniting locally then, I'll deploy it without
Tha question also, is to know if more RAM can fix the problème
I will try it tomorrow
I got some free time, so I'm looking into this
@naz Do you have some time to test?
yes of course
So I managed to crash as well, this is due to the memory and the nixpacks cache-ing to memory.
I found 2 solutions in your case which can help
1. What we did yesterday, disable lint and adding separately here is a file, which you should add to your root folder of your repo
nixpacks.toml
and disable the eslint
next.config
This alone maybe solves the issue
2. Enabling swap space in linux (which is basicly... saving some stuff to the disk and accesing from there) - I'm not an expert, you can find more info in the google, but I followed this tutorial and was like 3-4 min to do and easy to follow just running step by step the commands and changing a file
https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-22-04
How To Add Swap Space on Ubuntu 22.04 | DigitalOcean
One way to guard against out-of-memory errors in applications is to add some swap space to your server. In this guide, we will cover how to add a swap file tβ¦
I tried with 4GB and everything was ok
Both solutions interest me, so to optimise the VPS we should ignore eslint in the VPS but not in local as it's a double use
Nope, you use it in vps as well
Then the second solution to have a 4Go RAM VPS is okey
Because it's a safety stuff
ah okey I understand
So basicly you lint first and after run the build

why linting in production is important ?
The problem was that the build step used lint and validity type check at asme time
And used too much memory
Because it's safer to run before a deployment is out(maybe you forget linting)
For an example you change a component which has 3 props, and you add one more
You use this component in 4 places in your app
Eslint will tell you if you forget to update in a location
So let's say you added that prop in 3 places but forget to add in the last place
And it will detect it so you can fix it
Better to have it, than not π
Find and fix problems in your JavaScript code - ESLint - Pluggable ...
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
So the solution is to add nixpacks.toml
I'm not a senior dev so you, don't count in me π
I would do both of the solutions
Okey, am not a senior dev too π
Both of them helps with memory issues
I tried only with swap and worked with that as well (Using your repo)
So the solution to deploy a Next.js app is :
- add nixkpacks.toml
- disable eslint
- activate memory swap
or buy a 2vCore and 4Go RAM VPS
Yes, I would do all of them π
Nice
Actually just disabling eslint works fine for me so I go with this solution at a first step, then I will see the other steps
I'll do the eslint checks locally with
npm run lint
Thank you very much for the helpAnytime!
@Sang Dang Maybe this can help you too.
thank you, I disabled the eslint on dokploy building and run it on github actions instead, it reduced down to 5mins build π which is pretty good in our case
it used to 20 mins ha ha
How did you disabled eslint on DokPloy ?
ah my bad, I disabled the eslint in the build
ah okey
20 min even with 8Go RAM ?
no 20min with github actions
ok, I understand
Which package manager do you use?
but I think I will try to move the build back to dokploy after this
currently it's pnpm
Did you try moving from nixpacks to Dockerfile?
I did. I did not know the eslint caused the issue. So I had to build into dockerfile in github actions, and use it to deplpy on dokploy
Let me know when you try moving back to dokploy building because I would like to investigate the problem if it's still there.
sure I will, but it would not happen in near future, it is production app and we are quite out of resources to test