Not able to use an endpoint on railway but all other are working fine

I have an app where I have 2 apis, one is post request to create the users data and other post request to run a function. I am not sure why one of them works and other says CORS error while connecting from frontend which is built on next.js These both api endpoints are running fine when testing from postman with the deployed production link and locally as well. But the problem is one of the api is not working if hitting it from the frontend.
I have "Access-Control-Allow-Origin" header in frontend configured with "*" and backend with
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
expose_headers=["*"],
I have "Access-Control-Allow-Origin" header in frontend configured with "*" and backend with
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
expose_headers=["*"],
Can anyone help me with this
48 Replies
Percy
Percy14mo ago
Project ID: N/A
exotic4599
exotic459914mo ago
N/A
Brody
Brody14mo ago
are you sure you are using https
exotic4599
exotic459914mo ago
yes
youridb
youridb14mo ago
shouldn't allow_origins be "*"? just to check wether it works
Brody
Brody14mo ago
discord formatting error
youridb
youridb14mo ago
ah right haha mb
exotic4599
exotic459914mo ago
yes @Youri allow_origins is * actually all are *
Brody
Brody14mo ago
op, please enclose all multiline code with three back-ticks
exotic4599
exotic459914mo ago
ok done with 3 back ticks
Brody
Brody14mo ago
okay now can you send two full urls, one url that does work and one that doesn't work
exotic4599
exotic459914mo ago
how will it help?
Brody
Brody14mo ago
it should help me get a better understanding of what's actually going on you can't request an https service from a site running on http
exotic4599
exotic459914mo ago
but other urls are working how is it possible?
Brody
Brody14mo ago
I assume localhost was your frontend, and the railway domain was your backend?
exotic4599
exotic459914mo ago
yes
Brody
Brody14mo ago
when developing locally, run the backend locally too, that way both services will be running on http and you will be free to make requests
exotic4599
exotic459914mo ago
ok, so will then be any error if I also deploy the frontend somewhere where it has https?
Brody
Brody14mo ago
you can even run a local self signed https server for development, but yeah as long as both services run on the same http/https you won't have issues accessing HTTPS over http
exotic4599
exotic459914mo ago
Thanks @Brody , will try it, Also do you have any explanation to why other api endpoints are working and not this one? All are having the same configuration
Brody
Brody14mo ago
not sure
exotic4599
exotic459914mo ago
ok no worries, will try it out and ping here if problem persists
Brody
Brody14mo ago
no need for a ping, that kinda breaks the server rules
exotic4599
exotic459914mo ago
ok will update the status here, thanks
exotic4599
exotic459914mo ago
@Brody look this please, still the same one
Brody
Brody14mo ago
you received a status code of 500, that's the bigger issue here
exotic4599
exotic459914mo ago
can we use the server to store lets say a text file in the github repository thats been hosted with railway?
Brody
Brody14mo ago
explain your usecase
exotic4599
exotic459914mo ago
lets say I send a file and want the server to store it in the github repository and then use it when its required? the git repo is the same which is hosted as server
Brody
Brody14mo ago
you want to use a storage bucket like cloudflare r2
exotic4599
exotic459914mo ago
oh, is it so? Can't I just save it in the folder itself? Cause, I know we can do that in database but I am curious about this
Brody
Brody14mo ago
railway doesnt have persistent storage yet, but if it is just a text file, you can use redis?
exotic4599
exotic459914mo ago
oh, but it can atleast load the text files from some of the folders in the github, right? by giving relative paths
Brody
Brody14mo ago
yes you can do that, as long as you never write to the file, since the changes wont be saved across deployments
exotic4599
exotic459914mo ago
but I get the error: resource temporarily not available when I try to load a text file from the folder
Brody
Brody14mo ago
but using your github repo as a storage space is not advisable
exotic4599
exotic459914mo ago
yeah, but this is an MVP so its okay in this case
Brody
Brody14mo ago
how big is the text file?
exotic4599
exotic459914mo ago
the text file is probably 4 mb
Brody
Brody14mo ago
show the full error please
exotic4599
exotic459914mo ago
give me some time
Brody
Brody14mo ago
what language is this anyway?
exotic4599
exotic459914mo ago
python and typescript
Brody
Brody14mo ago
python and ts????
exotic4599
exotic459914mo ago
yes, why what happened?
Brody
Brody14mo ago
nothing just odd to combine those two
exotic4599
exotic459914mo ago
is there any disadvantage in this combination?
Brody
Brody14mo ago
I don't know what you are doing, so I couldn't say