R
Railway14mo ago
Mustafa

why I am facing weird javascript errors on railway servers ?

I am facing weird JS errors only on railway servers ?? it works on production locally, and in other cloud providers. I tried different node versions but still the same issue! seems you're building apps and run it in different ways !! that won't make our app works as expected!
20 Replies
Percy
Percy14mo ago
Project ID: N/A
Fragly
Fragly14mo ago
What weird javascript errors are you seeing?
Mustafa
MustafaOP14mo ago
e.g iam importing a js function and trying to use it like auth.check(params) I got undefing auth ?? currently i have connected with heroky, and it works as expected I think the issue may be in building or how you're start the app
Fragly
Fragly14mo ago
railway doesn't run code differently from any other hosting services as far as I'm aware, what does that function do?
Mustafa
MustafaOP14mo ago
setIsLoading(true)
const res = await authApis?.employeeLogin?.({ mobile, password, countryCode: "+966" })
setIsLoading(false)
setIsLoading(true)
const res = await authApis?.employeeLogin?.({ mobile, password, countryCode: "+966" })
setIsLoading(false)
it throws this error
Uncaught (in promise) TypeError: Cannot destructure property 'message' of 'c' as it is undefined.
at onSubmit
Uncaught (in promise) TypeError: Cannot destructure property 'message' of 'c' as it is undefined.
at onSubmit
runing localy in prod works as expected works also at heroku with the same code
Brody
Brody14mo ago
actually a lot of other hosting providers do a fair amount of monkey patching to get code to run, railway by contrast runs your code as is, so the best you can do is make sure railway runs your code with the same software you run locally, but beyond that it's a code issue
Mustafa
MustafaOP14mo ago
it works locally without any issues so i assume the code has no issues both in dev and in production
Brody
Brody14mo ago
unfortunately that does not mean it's not a code issue seen this a million times, it's the "works on my machine" meme
Mustafa
MustafaOP14mo ago
thanks for your help
Brody
Brody14mo ago
what node version is railway using, and what version are you using locally just trying to lighten up the mood
Mustafa
MustafaOP14mo ago
same node version 20
Brody
Brody14mo ago
okay same node versions that's good, this is pointing to a code issue now, as previously mentioned railway runs your code as is
Mustafa
MustafaOP14mo ago
I will try again Now this works
import { authApis } from "../../services/apis/auth/index";
import { authApis } from "../../services/apis/auth/index";
But this Not
import { authApis } from "src/services/apis/auth/index";
import { authApis } from "src/services/apis/auth/index";
Brody
Brody14mo ago
import paths are funky with js
Mustafa
MustafaOP14mo ago
It's handled by tsconfig and should works in all envs
Brody
Brody14mo ago
thats ts for you
Mustafa
MustafaOP14mo ago
any thing can help that from your side ?
Brody
Brody14mo ago
this isnt an issue with railway? (i also dont work for railway)
Mustafa
MustafaOP14mo ago
okay, thanks for your help appreciated
Want results from more Discord servers?
Add your server