Nicholas
RRunPod
•Created by Nicholas on 10/8/2024 in #⚡|serverless
Local Testing: 405 Error When Fetching From Frontend
Hi, I am trying to test my handler function by fetching data with my frontend (running on localhost:3000). I am running the local RunPod test server (FastAPI) locally and am trying to make requests to it. However, I keep running into a 405 error. My curl requests are working great; however, I need to test my backend from the frontend. I can't find documentation that demonstrates how I can allow requests from localhost:3000 -- normally I would just add a relaxed CORS policy, but I am not sure how to do that with RunPod. I have tried running quite a few different fetch requests, including with my API key, but nothing is working. For reference, here is what I am currently doing on my Next.js frontend:
const header_data = {
input: {
subjob: "root",
},
};
const response = await fetch("http://localhost:8000/run", {
method: "POST",
headers: {
accept: "application/json",
"content-type": "application/json",
authorization:
${RUNPOD_API_KEY}
,
},
body: JSON.stringify(header_data),
});
Here's the error message: [Error] Fetch API cannot load http://localhost:8000/run due to access control checks.
Any help would be greatly appreciated. If there is any further documentation that you can point me to, that could also be quite useful.
Thanks so much (in advance) for your help!1 replies
RRunPod
•Created by Nicholas on 10/7/2024 in #⚡|serverless
Endpoints vs. Docker Images vs. Repos
Hi, I am new to both Docker and RunPod, so my apologies if this question is overly obvious.
I am trying to convert a FastAPI app into a RunPod serverless endpoint. My question is, given that my FastAPI app has many endpoints, how can I access all those endpoints from just one RunPod serverless endpoint? Does it make more sense to create a serverless endpoint for every RESTful endpoint in my FastAPI app? Would I then need to create a different docker image for each endpoint?
I've spent a good amount of time looking through the docs, and most of the examples seem to use only one endpoint. Any resources you could point me to would be greatly appreciated.
Thanks for your help!
7 replies