7 months ago
Hi! I'm experiencing difficulties when trying to send POST requests to my API on Railway. Everything works perfectly when I run the project locally, and I also tested the API using Hoppscotch, which works fine. However, I'm encountering errors when attempting the same requests on Railway. Could you help me understand what might be going wrong and how to resolve this?
Thank you in advance!
API Next: https://justpaste.it/1s3rn
API IN RAILWAY: https://justpaste.it/h963x
10 Replies
7 months ago
I'm experiencing difficulties
What difficulties?
I'm encountering errors
What errors?
Unfortunately, we can't help without any information on the issue.
7 months ago
unfortunately I don't have much knowledge about the problem, but when I make a request using POST next Request in the server log this comes up “INFO: - ‘GET /compare-audio/ HTTP/1.1’ 400 Bad Request” locally it returns correct “INFO: - ‘POST /compare-audio/ HTTP/1.1’ 200 OK” on the front end side I'm using the same api and the same address.
7 months ago
Have a look at this docs section -
https://docs.railway.app/guides/fixing-common-errors#post-requests-turn-into-get-requests
7 months ago
unfortunately this is not the case i tested it on an https server https://projecta.top/game/1 and the same error is being returned i also checked how the request is being sent and it is correct there is no redirect
INFO: Application startup complete.
INFO: 127.0.0.1:59662 - “POST /compare-audio/ HTTP/1.1” 200 OK
INFO: 100.64.0.3:26984 - "GET /compare-audio/ HTTP/1.1" 400 Bad Request
7 months ago
Please give me an endpoint that I could query to see this behaviour for myself.
7 months ago
the closest thing to an endpoint I can send you is this link https://projecta.top/game/1 it records your microphone and sends it to the api which sends it to this api on the railway on the client side I can assure you that everything is working the problem is between my api: https://justpaste.it/e6cgu and the server on the railway generous-recreation-production-e712.up.railway.app both sides are public my api https://projecta.top/api/audio but I believe you won't be able to access it.
7 months ago
Given that this is an application level error and not a platform error -- I would need a simple example endpoint that showcases the issue otherwise I unfortunately won't be able to help here.
7 months ago
i believe it's an incompatibility between nextrequest and your side i'll try to host the api on vercel
7 months ago
This is not a platform issue, this would be a miss-configuration with your app, or due to how you are calling the domain.
5 months ago
Could you please check the value of process.env.NEXT_PUBLIC_COMPARE_AUDIO_IA_URL
?
If the URL starts with http://
, you should update it to https://
as this could solve your problem.
const response = await fetch(`${process.env.NEXT_PUBLIC_COMPARE_AUDIO_IA_URL}/compare-audio/`, {
method: 'POST',
body: formData,
});