method not allowed (python/fastapi)

streamerd
TRIAL

a year ago

Hello,

I've just tested python app locally and it was working alright.

Now deployed it successfully and the port was detected from dockerfile, all good.

But then checking the deploy logs, I see a redirect on my post then hitting to get and throwing a method not allowed err and idk why:

INFO: 100.64.0.3:30552 - "POST /detect_faces HTTP/1.1" 307 Temporary Redirect INFO: 100.64.0.2:14540 - "GET /detect_faces/ HTTP/1.1" 405 Method Not Allowed

Project:
56a9f5e1-f542-4450-9860-623ac58b1b47

endpoint:
https://face-detection-production-76b4.up.railway.app/detect_faces

to reproduce, send a post request to above endpoint with a multipart/form-data, body being a form data with key file and type file, then selected an image file from your computer.

here's the code:
https://github.com/stateful-art/face-detection

0 Replies

a year ago

little clarity needed here -

the port was detected from dockerfile
railway does not detect ports from the dockerfile, it is instead done by simply looking at what networked applications are running.

to reproduce, send a post request to above endpoint with a multipart/form-data, body being a form data with key file and type file, then selected an image file from your computer.
i did this and got a 500 Internal Server Error response


streamerd
TRIAL

a year ago

it is not properly working for all images yet, even in local setup sometimes throwing 500.

1262160457683435500


streamerd
TRIAL

a year ago

use this maybe :/


a year ago

lol okay


streamerd
TRIAL

a year ago

I get that post, 403 redirect then get request/method not allowed thing with this


a year ago

1262160753004253200


a year ago

are you sure you are making the request with https


streamerd
TRIAL

a year ago

yep. the only diff was the / at the end. now workd for me too
https://face-detection-production-76b4.up.railway.app/detect_faces/


streamerd
TRIAL

a year ago

without / at the end doesnt work


streamerd
TRIAL

a year ago

wtf hmm


streamerd
TRIAL

a year ago

@app.post("/detect_faces/")


streamerd
TRIAL

a year ago

now I know why


streamerd
TRIAL

a year ago

lol


a year ago

there ya go


streamerd
TRIAL

a year ago

thank u at least we know it works 🙂


streamerd
TRIAL

a year ago

hmm, how do I resolve this? there's something w closing


method not allowed (python/fastapi) - Railway Help Station