Issue with date-fns package
anyone recently having issue with date-fns in railway? my latest deployment is not working due to error
Error: Cannot find module '/app/node_modules/date-fns/index.js'. Please verify that the package.json has a valid "main" entry
But checking the node_modules manually. the packages files including index.js is found
What's weird is that, this only happen today. yesterday the deployment work fine
114 Replies
Project ID:
d85df9df-e8f2-42e7-81ea-4e1929823be4
d85df9df-e8f2-42e7-81ea-4e1929823be4
please share your repo
hmm it's a private repo. but this is the package.json
this was the green deployment yesterday
https://railway.app/project/d85df9df-e8f2-42e7-81ea-4e1929823be4/service/04f7bad6-9243-4163-81f6-648ad8ec8daf?id=1159acdc-9143-4376-b5f2-f62b0b9ee70c
Railway
404 - Page not found
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
no changes with the packages today
when i rollback to that build its working
the strange is that, there is no other update really. and if i try to re deploy using the same code base (no update) the issue will show up
is there any issue with the build just today?
this is unlikely to be a specific railway issue
have you done this?
another reason this could be happening, are you commiting your node_modules folder to github?
No, im not comitting node_modules to github
yeah, I thought of that as well that its not a railway issue. but what bugs me is that it just happen with todays deployments
btw, this is a nestjs project
oh yeah there's none. I will try to add
same
think that error points to date-fns package
please provide a build log from the working build. and then a build log from the most recent broken build.
https://bookmarklets.up.railway.app/log-downloader/
working build
that is the deploy logs, please provide build logs
ohh
im seeing "No build logs found for deployment" with working build. few min I will revert to this build and see if build logs will be populated
sounds good
in the mean time, please send the build logs for the newest broken build
done reverting the working build. I see "No build logs found for deployment" still. maybe this is because it has been build before and was pulled from cache now?
ok let me pull up the latest build logs with current with error
one with error build
can you revert your repo to the point in time the last successful deployment was made?
I did that earlier and able to experienced the issue. but I will try again now for you
do you have the date from when you made the last successful deployment? (not a revert)
it was on Feb 28, 2024 10:10 pm
btw, I just revert my repo to last working build
and it fails
you reverted the repo to before feb 28th?
on i've reverted on that date(feb 28). that's the first time I deploy this project in railway
btw, a note as well. I have other project using date-fns deployed in railway - been running almost a year already
now with this error. im afraid if we deploy to the other project might have the same issue 😄
can you try deleting your yarn lock file and then re-syncing it
you can bring your repo back up to date now
yeah actually done that as well earlier as well. I will do it again for you
would you happen to know the node version in use by the last working build?
hmm no
but earlier while debuggin. I logged in server from my local using cli. I checked the node version in server and setup the same version in my local. Im not able to experience the same error in my local
the cli does not allow you to "log in" to the container
you where running commands locally
ohh
I was running
railway run node -v
thought that's from serverthat runs the command locally
ok, thanks for correcting
does the package.json have a valid main entry now?
ahh updating back. was reverted earlier
updated. same error
would you be willing to add me to the repo?
sure yeah
pls share your github email I will give you read access
brody192
ok let me add you
added you already
https://github.com/ASP-PH/fuel-api
what branch is railway set to deploy from?
develop
is
dist/main.js
the correct path to the generated file?ohh wait let me double check
ohhh should be dist/src/main.js 🤦♂️
will try to deploy
is this the path the main.js file ends up being put locally?
yeah for
yarn build
command
done, same errorwait why is date-fns being used?
for my date helpers. thats found in
src/utils/date.ts
have you told me your local node version?
im currently using
18.18.1
as far as i know, railway would be using node 18.19
ohh ok. I can update
I can't see any obvious reasons why this error is showing and only in railway
just some tiny config issue, its a tricky one
hmm yeah
your start script is
nest start
are you sure this is running the built main.ts file?
maybe try changing your start command on railway to your start:prod
script?did that already
and the build I set to
yarn build
ohh2 it seems working already with my latest pushSolution
updating the target in your tsconfig.json to es2020 eh?
yeah
seems that fixed it
awsome, see, just a tiny misconfiguration
haha thank you so much for the help!
no problem, happy you where able to solve this
feel free to remove me from th github repo 🙂
im your latest supporter 😄 https://www.buymeacoffee.com/brody192/c/8685971
Buy Me a Coffee
Brody is Helping in the Railway Community Discord server!
Hello! 👋I don't work for Railway 🫠
will remove you in the repo
i was trying to figure out who that was lol
thank you for the train!
lol
sure, welcome
Hi @Brody im seeing the issue again. nothing is changed in my end
I mean no updates for compiler hahaha
question, does railway randomly change their builder?
Actually this already happen yesterday. I didn't notice the failed build. This is the build log yerterday. it shows network error.
it's givin me headache already hahaha
can't focus on my development lol
first build log is for an issue with date-fns, second build log is an issue with cache, what is the current issue you get?
the issue with date-fns is the latest
hmm I will try to clear cache by running
railway run yarn cache clean
that does not clear the cache on railway
ohh ok
that runs a local command
ok
so the latest build is failing because it can't find date-fns?
yeah same as before the one fixed already with changing tsconfig > target > 2022
is there a way to know what node version or how railway build? what i know only is that its using nixpacks
node 18, printed at the top of the build logs
have you modified your package.json? this is a different error from before, this time it just looks like it's outright not being installed
no nothing
add me back to the repo?
sure2
added
what branch is currently set to deploy to railway?
develop
these are test commits I did to try to fix the issue after the error build
I've probably asked you this before, but you do use yarn locally right?
yeah i use yarn in my local
what version?
v1.22.21
okay close enough to what railway uses
can you delete the lock file, and then regenerate it, let me know if git says it has changed
ok. I did that already earlier tho
nothing change
so how opposed would you be to switching to just npm as a test? (I'm running out of ideas)
aka delete your yarn lock file and generate an npm lock file with npm install
hmm been a while since i use npm 😄 tho I will try if that solve the issue
and to answer this question, yes they do, not intentionally, they rebase the image to get some os level security updates and sometimes they change the version of nix being used and that also can cause issues. but railway has not changed the builder since we last talked.
ok cool. noted
btw, deploying with npm
is the install command listed as
npm ci
?hmm think might be cache. after this I will back to yarn and try this NO_CACHE option
https://docs.railway.app/guides/build-configuration
sorry didn't get you
ohh npm works
build is green
in the build table at the top of the build logs
i'll try yarn now if it fail again
ahh yeah it is
yeah this might be a cache issue
deploying now with yarn using no cache option
nah it worked 😄
I guess caching needs to be fixed by railway. for now, I will add no cache whenever I experienced this issue
this is not good tho. we choose railway so can just focus directly on development with 0 configs on server
Thank you! it's good chatting with someone with your knowledge. I get ideas hehe
while this particular experience is not good, from personal experience, unfortunately there is no such thing as zero configuration deployments, on any platform
yeah agree but something like this error is kind of frustrating 😄
I agree
or railway might add this as a note in the docs
that's fair
i'll remove you from repo now. Have a great day ahead. Thank you for your help!
happy to help!
ohh just fyi. i removed no cache and it fails again. seems I can't use cache for now hehe
if you have any updte on the caching pls let me know
the cache on the host machine is likely in a bad state, best to keep the no cache variable