R
Railway14mo ago
FelipeJz

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
Percy
Percy14mo ago
Project ID: 34af0f96-e1f7-4e9c-94ae-da7f54d94d4e
FelipeJz
FelipeJz14mo ago
34af0f96-e1f7-4e9c-94ae-da7f54d94d4e
Adam
Adam14mo ago
Please send your logs using this tool https://bookmarklets.up.railway.app/log-downloader/
FelipeJz
FelipeJz14mo ago
I can't figure out what is the issue. It always builds the first time.
Brody
Brody14mo ago
read the build logs and fix the errors its telling you about please
FelipeJz
FelipeJz14mo ago
Those errors do not exists in any local build. Also i'm not even using next pages, i'm using the app router
Brody
Brody14mo ago
why does your app seem to think otherwise lol
FelipeJz
FelipeJz14mo ago
No description
FelipeJz
FelipeJz14mo ago
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.
Brody
Brody14mo ago
try setting NIXPACKS_NO_CACHE to 1
FelipeJz
FelipeJz14mo ago
As i explained in the first message, i did find that solution in other threads and tested it It doesn't work
Brody
Brody14mo ago
are you deploying from the correct repo/branch?
FelipeJz
FelipeJz14mo ago
Yes, is the only branch
Brody
Brody14mo ago
then im thinking this is a code issue, as railway runs your code as is
FelipeJz
FelipeJz14mo ago
Oh well, it works great the first time, why it wont re deploy even the same deployment though?
Brody
Brody14mo ago
im sorry i dont know
FelipeJz
FelipeJz14mo ago
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
Brody
Brody14mo ago
where did you set this
FelipeJz
FelipeJz14mo ago
Service variables
Brody
Brody14mo ago
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
FelipeJz
FelipeJz14mo ago
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
Brody
Brody14mo ago
thats what this was disabling
FelipeJz
FelipeJz14mo ago
No description
Brody
Brody14mo ago
all signs point to code issue
FelipeJz
FelipeJz14mo ago
Is the code completely replaced in every deployment?
Brody
Brody14mo ago
yes it is thats why if you ever save a file not into a volume the file is lost on every deployment
FelipeJz
FelipeJz14mo ago
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
Brody
Brody14mo ago
okay not a code issue but very similar, happy you found a fix!
FelipeJz
FelipeJz14mo ago
Great, thank you
Want results from more Discord servers?
Add your server