0👍
Here are a few of the troubleshooting steps I would take
-
I would try to log out the request on the server. Does the request coming in from the frontend look like you expect it? Often when i see this kind of problem, the request body is surprising and that insight helps me discover the real problem.
-
I would confirm that the request format that you are sending matches the format your server is expecting. For example, your server may be expecting form data but you are sending json. This often is sent across automatically in the header.
One way that I like to verify this is to make the request in the browser and then go to the network tab and right click on the request. There should be a "copy as CURL" option. Make that request from the terminal and you should see the same result. Now go to a tool like postman and try to send a request using the same body data that your curl command is sending. Do you see the same result? If not, you likely now know that it may be that your content-type header is incorrect. Using different tools helps me sanity check what part of the data I’m sending to the server is causing the problem. Once you know which part of your data is causing the issue, troubleshooting from there should be much easier for you.
So in short, check that the headers and body are what you expect them to be on the server, and that the libraries you have imported on your server support the body format you expect.