NextJs build deploys the first time and then all deployments fails.
For some reason i get the error "ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 1" on new deployments, the first one seems to work just fine. I tried adding NIXPACKS_NO_CACHE = 1 and CI = false, no luck, the help will be appreciated! Thank you.
30 Replies
Project ID:
34af0f96-e1f7-4e9c-94ae-da7f54d94d4e
34af0f96-e1f7-4e9c-94ae-da7f54d94d4e
Please send your logs using this tool https://bookmarklets.up.railway.app/log-downloader/
I can't figure out what is the issue. It always builds the first time.
read the build logs and fix the errors its telling you about please
Those errors do not exists in any local build. Also i'm not even using next pages, i'm using the app router
why does your app seem to think otherwise lol
It only happens in Railways, deployed to other services without any issue, the fixes for those errors are not related to my code. And it deploys ok the first time, subsequent deployments (even a simple console.log update) won't deploy.
try setting
NIXPACKS_NO_CACHE
to 1
As i explained in the first message, i did find that solution in other threads and tested it
It doesn't work
are you deploying from the correct repo/branch?
Yes, is the only branch
then im thinking this is a code issue, as railway runs your code as is
Oh well, it works great the first time, why it wont re deploy even the same deployment though?
im sorry i dont know
Anything that i could try? I mean, it works once, to re deploy i have to delete the service and create a new one, which is not an option for production purposes
where did you set this
Service variables
then im sorry, its not the answer youd want to hear but, fix your code?
railway runs your code as is
this is an extreme bizzare issue, but at this time i dont think its an issue with railway
I don't know about that for what i'm seeing, isn't weird that it won't re deploy the same code right after a sucessful deployment? Some state or cache has to be saved somewhere for that to be happening
thats what this was disabling
all signs point to code issue
Is the code completely replaced in every deployment?
yes it is
thats why if you ever save a file not into a volume the file is lost on every deployment
I fixed it. My NODE_ENV variable was conflicting with the builder it seems. After checking i confirmed that Railway has my project in production by default
okay not a code issue but very similar, happy you found a fix!
Great, thank you