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