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