Build starting to fail where previous deploy were OK
Hi, I'm having a hard time to understand this one.
My previous deployment worked fine but now it refuses to build with that error "Cannot read properties of undefined (reading 'indexOf')"
That doesn't make any sense since I didn't change anything as you can see in the screenshot (cf merge pr #375 of course)
25 Replies
Project ID:
d6a04e84-91e3-4e5a-94eb-11dae5cca406
d6a04e84-91e3-4e5a-94eb-11dae5cca406
(fiy, everything is still building ok locally of course)
It goes from Merge pull request #375 to Merge pull request #377
I think someone accepted a bad pull request
(same error on the other env, latest working deploy => redeploy to test => same crash)
It's definitally an error in your code, railway runs your code as-is
Def not I must say ^^
I redeployed #375 (forget about the others)
oh that's true, didn't see that
but I still think it's a code error
(no worries - the new screenshot is from the other env)
Same docker img, same pr, just 20h of diff
1st logs:
#12 [build 6/6] RUN npm run build --omit=dev
#12 1.114
#12 1.114 > [email protected] build
#12 1.114 > react-scripts build
#12 1.114
#12 2.569 Creating an optimized production build...
#12 2.711 Browserslist: caniuse-lite is outdated. Please run:
#12 2.711 npx update-browserslist-db@latest
#12 2.711 Why you should do it regularly: https://github.com/browserslist/update-db#readme
#12 46.16 Browserslist: caniuse-lite is outdated. Please run:
#12 46.16 npx update-browserslist-db@latest
#12 46.16 Why you should do it regularly: https://github.com/browserslist/update-db#readme
#12 48.97 Compiled successfully.
And logs from now on:
#12 [build 6/6] RUN npm run build --omit=dev
#12 0.646
#12 0.646 > [email protected] build
#12 0.646 > react-scripts build
#12 0.646
#12 2.111 Creating an optimized production build...
#12 2.264 Browserslist: caniuse-lite is outdated. Please run:
#12 2.264 npx update-browserslist-db@latest
#12 2.264 Why you should do it regularly: https://github.com/browserslist/update-db#readme
#12 43.61 Browserslist: caniuse-lite is outdated. Please run:
#12 43.61 npx update-browserslist-db@latest
#12 43.61 Why you should do it regularly: https://github.com/browserslist/update-db#readme
#12 45.32 Failed to compile.
#12 45.32
#12 45.32 Cannot read properties of undefined (reading 'indexOf')
What changed on Railway between these last 20h?
It might be a code error, but that wasn't an issue before -_-'.
Since nothing changed on my end, something had to on Railway?
Nothing has changed on railway in the last 20 hours, the last time they've announced a change was a week ago
🤔
I recommend finding and fixing the error in the mean time, even if it didn't cause an error before
really weird that it has worked before and doesn't work now, unless it's a logic error - logic errors can happen any time in production
Yep, I'm trying, while but googling this one other cases don't seem to be relevant to my issue...
What do you mean by "logic error" in this case?
an example would be, a user submits a request on your site for ice cream, they can pick between toppings: choc sprinkles, rainbow sprinkles, syrup and melted chocolate
your code expects one of those toppings but a user didn't want any toppings and instead just put "none" in there
upon receiving the request, your code tries finding the toping string in a table filled with toppings but since "none" is not a toping it returns undefined, and whatever you do with that table will cause an error "attempt to index SOMETHING with undefined"
idk logic error is the right word for that actually
But during build?
oh, okay yea I have no idea
that is indeed weird
Also, these 2 env don't have the same backend/db, and these are not called during building, afaik
Cannot read properties of undefined (reading 'indexOf')
Should refer to a running error of map, doesn't make a lot of sense to be triggered while building no?
yea, for sure, I didn't know it was happening during build ( probably should';ve realized when you sent build logs, my bad, just woke up )
I just bulletproof every map call in my reactapp, didn't change anything
Someone smarter than I am will probably see this and be able to help, I have no clue
It could help to have more details during the build but I cannot figure how to max verbose mode there...
Any idea? (building with "react-scripts build")
Maybe a clue, it seems like the node img changed, build are starting to fail with that version:
docker.io/library/node@sha256:bf718fc580177cd927173c8617cf7f527a1b7f62c7de882ee17a42d065f4b70e
OMG I did force the node img to node@sha256:bd20621deff56cb66c6cd10772d26db1a0d480f2b08609eb96b799ba6260f3ed and the error is gone...
So it was indeed that ><.
All I have to do is understand why this new version is no longer compatible!
Glad you figured out the problem
Thanks, not solved yet, but that's a start ^^
FYI: https://github.com/vitejs/vite/issues/14691
After upgrading locally to node 21, I can see the sass error too...
GitHub
sass not working with node 21 · Issue #14691 · vitejs/vite
Describe the bug Using sass on node 21 is throwing errors. Reproduction https://github.com/brc-dd/vite-sass-bug Steps to reproduce Run pnpm install followed by pnpm dev. Issue seems to arise from t...
Solution
Issue Solved by using docker:
FROM node:lts