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
Percy
Percy2y ago
Project ID: 1511f570-4668-48b5-b37a-10e1d58d6305
lucaszdevmmyers616
project ID: 1511f570-4668-48b5-b37a-10e1d58d6305
Brody
Brody2y ago
Someone else had this exact same issue earlier, could I take a look at your repo?
lucaszdevmmyers616
the repo is private and have the database credentials, but here are the images:
lucaszdevmmyers616
it's just this, the addUser is just a insert sql in localhost works fine but in deploy server not worked
Brody
Brody2y ago
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?
lucaszdevmmyers616
yes yes
lucaszdevmmyers616
here is the addUser
lucaszdevmmyers616
if I change the route method to get, and in addUser I return a simple json, it worked, but with POST don't work
Percy
Percy2y ago
Hey <@925773520103931995>, Please link your discord account to railway.
Brody
Brody2y ago
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
lucaszdevmmyers616
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
Brody
Brody2y ago
Someone else just posted the same issue but for Go, let me do some investigation and I'll get back to you
lucaszdevmmyers616
thankss
Brody
Brody2y ago
lucaszdevmmyers616
I'm not requesting with https
lucaszdevmmyers616
but now I add is correctly?
lucaszdevmmyers616
now I'm getting the same error, but before is not this HTML
lucaszdevmmyers616
now is different html
lucaszdevmmyers616
and, without the www.
lucaszdevmmyers616
error 500
lucaszdevmmyers616
now the Request Body is sending, before RB is not showing up here, but it's 500 code error
angelo
angelo2y ago
500 is different than the method change. But at least its accepting the POST yes?
lucaszdevmmyers616
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
Want results from more Discord servers?
Add your server