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
Percy2y ago
Project ID: N/A
exotic4599
exotic4599OP2y ago
N/A
Brody
Brody2y ago
are you sure you are using https
exotic4599
exotic4599OP2y ago
yes
youridb
youridb2y ago
shouldn't allow_origins be "*"? just to check wether it works
Brody
Brody2y ago
discord formatting error
youridb
youridb2y ago
ah right haha mb
exotic4599
exotic4599OP2y ago
yes @Youri allow_origins is * actually all are *
Brody
Brody2y ago
op, please enclose all multiline code with three back-ticks
exotic4599
exotic4599OP2y ago
ok done with 3 back ticks
Brody
Brody2y ago
okay now can you send two full urls, one url that does work and one that doesn't work
exotic4599
exotic4599OP2y ago
how will it help?
Brody
Brody2y 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
exotic4599OP2y ago
but other urls are working how is it possible?
Brody
Brody2y ago
I assume localhost was your frontend, and the railway domain was your backend?
exotic4599
exotic4599OP2y ago
yes
Brody
Brody2y 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
exotic4599OP2y ago
ok, so will then be any error if I also deploy the frontend somewhere where it has https?
Brody
Brody2y 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
exotic4599OP2y 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
Brody2y ago
not sure
exotic4599
exotic4599OP2y ago
ok no worries, will try it out and ping here if problem persists
Brody
Brody2y ago
no need for a ping, that kinda breaks the server rules
exotic4599
exotic4599OP2y ago
ok will update the status here, thanks
exotic4599
exotic4599OP2y ago
@Brody look this please, still the same one
Brody
Brody2y ago
you received a status code of 500, that's the bigger issue here
exotic4599
exotic4599OP2y ago
can we use the server to store lets say a text file in the github repository thats been hosted with railway?
Brody
Brody2y ago
explain your usecase
exotic4599
exotic4599OP2y 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
Brody2y ago
you want to use a storage bucket like cloudflare r2
exotic4599
exotic4599OP2y 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
Brody2y ago
railway doesnt have persistent storage yet, but if it is just a text file, you can use redis?
exotic4599
exotic4599OP2y ago
oh, but it can atleast load the text files from some of the folders in the github, right? by giving relative paths
Brody
Brody2y ago
yes you can do that, as long as you never write to the file, since the changes wont be saved across deployments
exotic4599
exotic4599OP2y ago
but I get the error: resource temporarily not available when I try to load a text file from the folder
Brody
Brody2y ago
but using your github repo as a storage space is not advisable
exotic4599
exotic4599OP2y ago
yeah, but this is an MVP so its okay in this case
Brody
Brody2y ago
how big is the text file?
exotic4599
exotic4599OP2y ago
the text file is probably 4 mb
Brody
Brody2y ago
show the full error please
exotic4599
exotic4599OP2y ago
give me some time
Brody
Brody2y ago
what language is this anyway?
exotic4599
exotic4599OP2y ago
python and typescript
Brody
Brody2y ago
python and ts????
exotic4599
exotic4599OP2y ago
yes, why what happened?
Brody
Brody2y ago
nothing just odd to combine those two
exotic4599
exotic4599OP2y ago
is there any disadvantage in this combination?
Brody
Brody2y ago
I don't know what you are doing, so I couldn't say
Want results from more Discord servers?
Add your server