FastAPI RunPod serverless request format
Hi everyone,
Second post from me. I am (still) trying to deploy a FastAPI app in a Docker container hosted on a serverless RunPod. Here is a toy example:
The code is deployed as a Docker image with the port 8080 exposed.
My problem is: I just can't figure out how to format my requests so that the payload hits the FastAPI path. This is the format I started with:
The request does get to the serverless worker, but then just hangs without being forwarded to the FastAPI path method.
Am I missing something here?
P.S.: last question from me I swear.
12 Replies
haha dont worry about asking questions, okay and where's your handler code?
i dont see runpod.serverless.start() there
Her @nerdylive , thanks for answering so fast.
No handler code: I created the serverless through the web GUI. Here is my template, with some fields obfuscated for safety
Okay maybe you got the serverless wrong, read the docs, and read the runpod-workers github repo for example of Serverless workers
But the request format seems right yes you should do it like that
And also some note, that you can't run docker inside serverless or pods ( with gpu ) because of security reasons if I'm not wrong
Yeah I know for no Docker-in-Docker, I'm just launching the base image used to make the template just like RunPod would with any pre-built image.
Stuck scratching my head at the moment - I've been following the docs to the letter, and I am having the same problem with a normal Pod rather than serverless. Deploying the same image to a Pod and running the same request gives:
Ohh so the slot there is actually for CMD or entrypoint
Exactly
Search on github runpod workers
Or in google
Runpod workers
Find a repo in that org
That's an example you can use
Tried just that - found this one, which looks very similar to my use case https://github.com/dannysemi/runpod-serverless-proxy/tree/main
And I can't find anything they do that I don't. Starting to think I may be a little dense.
GitHub
GitHub - dannysemi/runpod-serverless-proxy
Contribute to dannysemi/runpod-serverless-proxy development by creating an account on GitHub.
GitHub
GitHub - runpod-workers/worker-template: 🚀 | A simple worker that c...
🚀 | A simple worker that can be used as a starting point to build your own custom RunPod Endpoint API worker. - runpod-workers/worker-template
Start here
No, its not meant to run inside serverless, but in other server it works
look here it always starts from dockerfile
runpod.serverless.start({"handler": handler})
This is the important path that starts it