Railway is not accepting POST method calls
Hi, I deploy a simple nodeJs server, and the POST calls is not working, in localhost works fine but in the deploy server I'm getting this issue: Cannot GET /addUser
But I'm sending a POST call I don't understand that, if in the routes I change from POST to GET and send a GET call to the same route, it worked, but POSTs don't worked, What can be this??
24 Replies
Project ID:
1511f570-4668-48b5-b37a-10e1d58d6305
project ID: 1511f570-4668-48b5-b37a-10e1d58d6305
Someone else had this exact same issue earlier, could I take a look at your repo?
the repo is private and have the database credentials, but here are the images:
it's just this, the addUser is just a insert sql
in localhost works fine
but in deploy server not worked
I'll just quickly say this because I'm sure you already know this, please don't store credentials in GitHub, even a private repo
But, could I see the adduser route?
yes
yes
here is the addUser
if I change the route method to get, and in addUser I return a simple json, it worked, but with POST don't work
Pretty good looking code imo, nothing stands out to me.
If you wanted to provide me with a minimal reproducible example id be happy to debug it
thanks, it's a simple nodejs project, it's only these 2 routes and 3 files
but I really don't understand why POST method is not working, in the log don't have any error
Someone else just posted the same issue but for Go, let me do some investigation and I'll get back to you
thankss
Are you sure you're requesting with the HTTPS scheme?
https://discord.com/channels/713503345364697088/1074097491265466499/1074127851860791336
I'm not requesting with https
but now
I add
is correctly?
now I'm getting the same error, but before is not this HTML
now is different html
and, without the www.
error 500
now the Request Body is sending, before RB is not showing up here, but it's 500 code error
500 is different than the method change. But at least its accepting the POST yes?
yes
now its accepting
What this 500 error code can be?
I think I have make work
The problem is solved just adding the https:// and changing the Body to raw, I don't know why x-www-form-urlencoded not worked and return 500 status error , but with raw worked!
Thanks so much @Angelo and @Brody