99 Replies
Project ID:
N/A
N/A
You'll need to provide a lot more information than that
This is the error I am getting on the back
This is my backend code
Nevermind I found the issue
I have an issue where the front end is trying to connect to this backend endpoint, but is throwing a weird error
As it says, youre missing an
Access-Control-Allow-Origin
header to allow requests between the twoMDN Web Docs
Access-Control-Allow-Origin - HTTP | MDN
The HTTP Access-Control-Allow-Origin response header indicates whether the response can be shared with requesting code from the given origin.
Hi, Im the developer working for FlippingPal (hes out for now, he went to sleep) but I will ask some stuff about this error we were having
So these CORS errors happened to me the other day too, I realised it was some other error that I ended up fixing and that got fixed automatically. So the CORS error seems to be misleading sometimes or at least gets caused right in coincidence with other unrelated error.
So we are allowing cors from everywhere in the code as well
What seems strange is that I already had this deployed on my server before help him getting setup the backend on his own railway, and code is same but in mine is working, its quite strange
I guess we will double check env variables when hes around again but until then I wonder what else could it be, no idea tbh
open the backend url directly in your web browser
which one, my own backend server or the one from FlippingPal (my customer) ?
the one you are having issues with
right, the customer one: https://back-production-0201.up.railway.app
it says it cannot get /, which seems normal because I dont have any route in my code pointing to the base url
although the console gives me that error and probably thats not so normal anymore, right?
502 bad gateway
check your http logs on the deployment
oh, yeah, i guess i will have to wait until hes back for that, dont have his railway access
going forward you should probably both be on the same railway team
yeah I saw that and told him I didnt know how to use that yet but we will probably use it
is it hard to setup? I have never ever used that
can he just add my railway user to it or something like that?
you already have a team on Railway, just add them to it
hes the one who will pay the bill tho
so i assume he should be the owner of the team
whatever works best for you
yeah we will do like that, when hes back we get to talk about this
ā
i just checked, error cannot be that because it also appears in my working backend:
so its gotta me something else
I guess I will just add some console.logs and be pushing so I can see whats going on, thats also a way
check the http logs first when he is back
ah right, so you recommend me to wait for him before trying stuff, right?
otherwise the http logs gonna scroll up and disappear eventually i think
idk
my gut feeling is that your backend is crashing
yeah, whats crazy is that we managed to register a user and still throws us an error but database working fine
i know theres a payment processor thingy we dont have setup correctly yet but it should not crash the entire thing
but yeah i will just check when hes back, we see the logs on his railway then
Btw out of curiosity for future projects, does Railway support a backend running on Rust?
@Flipping Pal So we are having issues with the login-with-token endpoint now for some reason, it throws a CORS error. But the normal register and login seem to work fine
thats the error we are getting
@PrivateScript is helping me with the project
yes
so we added some console.logs to that endpoint to see if theres like any errors and it wont even show the 1st console.log which is right at the start of the endpoint
its basically as if it was not receiving the request even
we really need help here I got no idea how to debug it
jup, did that a few times
any error on the backend side?
Thats nice!
theres no logs on the backend when I hit the endpoint although I did place few console.logs, none of that appears as if basically the endpoint is just not getting hit, which seems extremely strange to me and basically impossible to debug
can you try setting the header "Access-Control-Allow-Origin" with the value *?
i will take note and whenever my customer is available I will tell him to try this, but I will tell you one strange thing: I do have this same backend deployed on my own railway, and it works without any error. Makes me think theres an error somewhere thats not code related.
And btw some of the endpoint in the same router going through the same cors() middleware are not throwing that cors error, so I dont believe its actually anything CORS related but rather cors error being a side effect of some other error
rn it seems like its screaming about cors, that happends in one of the following 3 cases:
- No Cors header being set at all
- Webserver crashing/not reachable (the cors header is not being sent to the client thus chrome sees it as no cors header being set)
- Some other setting regarding cors is incorrect
i wonder if its something server related, because as i said code is exactly same code in my own railway and it works perfect, if it was purely cors error why would the same code work on one place and not the other, right?
maybe some settings on the railway service, idk, something like that, no idea tbh
sounds weired tbh, i have never seen the same
is the webserver actually reachable?
me neither and i have been programming for few years already, no idea
lets do some test with my postman
with correct token as well, but like, it just doesnt reach anything
i guess the webserver is either not listening on the right port or smth else goes wrong
oh sorry i made accidentally post request with postman, its a get
let me try again
yeah something weird like that could be no idea
seems like the token is different because is customer database, its whatever, but i get a proper error so the endpoint in theory its working
when hes back i will check his backend service logs after doing a get request with my postman hopefully through the console.logs maybe something appears, idk
wait wtf
mine isnt working either now
and this one was working 2 days ago last time i deployed, i havent changed anything
somethings weird here, any support available?
oh I found an issue, about external APIs im using, could be that
just to clear any possible confusion, this is not an issue with the platform.
okey so now the external APIs are working
and i get it working on my own backend deployment
but not on the customers deployment
check the http logs for it
@Brody Hold on we got to fix small step due to env variable
so thats 1 thing
now we need to delete redis storage so that our backend re-fetches data again, how can we do a flush all of the redis service?
connect to it and delete the keys
yeah we did, im just so surprised that some data fetchs that are not even using env variables are literally coming undefined while in my backend deployment with the same exact thing it wont, it makes 0 sense to me, makes me think maybe numeric domains are blocked automatically due to security or something like that
because my domain is https://service-backend-project-ah-production.up.railway.app/
but customer domain is https://back-production-43b4.up.railway.app/
which is the main difference i see here, code is same. env variables are same. (except for reference ones like backend/frontend where we checked like 5 times they are the correct ones for each)
have you ever heard of anything like this, Brody? maybe some people are blocking domains with numbers on it due to usually coming from non-trusted places?
have you checked the http logs yet?
yes
sorry i was talking with customer
this is not a platform issue
we checked like 50 times
http logs, deploy logs, we getstrange errors
please send a link to the service in question
yeah the customer service or my working service?
the service with the domain from the cors errors
yeah the customer service... he just went to sleep :S
thats why im writing here now we were trying to debug looking at the logs and my console.logs
this is the url thats only thing i got for now: https://back-production-43b4.up.railway.app/
thats a different url than whats in the screenshot?
oh sorry
i manually changed it because i hsd copied the front thing
yeah numbers are different
i will copy correct one
got it on postman i think 1 sec
ye
https://back-production-0201.up.railway.app/
can you find the project somehow with the url?
yes
š
so basically, on the logs im logging some length of some stuff im fetching, some cases it shows undefined but i double check the urls they give me undefined (its just a json file) and i can see it right away on the browser, like, the endpoint is not failing, and my code on my project is exactly the same and it will work but how the same code on his domain wont work then? this seems like black magic to me
you havent checked the http logs
wait http logs you mean the network logs in the frontend?
backend
i havent seen those, you see anything strange there?
dont know where they are
i double check now
on my backend tho dont have his now he was screensharing with me but went to sleep
cause we different timezones
i see mines
im blind i never see that
so do you see anything to strange in those?
304 is fine i dont have stripe setup thats normal
i see
/market/ah-data-new/us
giving a 502i saw that as well just from the frontend network and console errors when he was screensharing, but code is identical and env variables as well, which makes me completely lost
that would be an issue with your backend code
but in my railway it works and its same code, so how can him fail then
š¢
i guess next day we will just redo the entire backend setup, its only thing I can even think of, something cursed there i cant figure out so just re-launch the entire thing on different service
you need better logging, your app is failing to respond to a request
im not using asia region, why is that there? im using us region
where it says edgeRegion
whats that
none of us are from asia neither our railway server
thats the region the request was made from
none of us are from asia we dont using VPNs or proxies, wtfunk?
i dont make the rules haha
ah
Im thinking one thing, domain has numbers, I believe only china domains usually have numbers
therefore railway is thinking its coming from China
no, again, this is not a platform issue
then i got some chinese hacker or something lol
nothing to hack there tho idk what he looking for š
it doesnt mean its someone from china
thats just the closest region we own for that ip
ah right, i can imagine then
geoip on that ip places it in Australia
that makes sense
hes from there
and im from europe
right, yeah
please remove his ip from the image or delete the image, he takes security very seriously. but thanks for the help attempt i will just look further with him and try to figure out a way to debug this
ip addresses are not sensitive info fwiw
i told him this as well, will screenshot this for proof xd
either way, theres not much more we can help with as these issues you are facing are not platform issues, but issues with your own code
yeah i will try to fight that on my own i guess see what i can do
i wish you the best of luck
thank
ā¤ļø
one platform question this time tho
can he just make a team and i fight the project on my own without him having to be on call, do i get like full access to the services?
yes as long as he adds you as an adminn to his team, you have full access