Having issue with FastAPI

Issue Summary
I’m building a full-stack AI PPT Generator application using FastAPI and Next.js. I followed the structure and setup from this Vercel template. However, in my own project (GitHub Repo), the FastAPI backend is not being deployed properly, even though the Next.js frontend deploys successfully.


Current Behavior

  • The FastAPI server fails to deploy.
  • When deployed, trying to hit FastAPI routes results in a 404 error (Page not found).

Expected Behavior

  • The FastAPI server should be deployed and running as expected alongside the Next.js frontend.

Steps to Reproduce

  1. Set up a FastAPI backend (served via /api or similar route) and run it locally—it works as expected.
  2. Build and deploy the app following the template instructions.
  3. Observe that only the Next.js frontend is served; FastAPI endpoints are unreachable and return a 404.

Additional Notes

  • I’ve followed all instructions in the original template.
  • I also looked through other related blog posts and issues, but none of the suggested solutions worked.
  • My codebase and configuration are available here for review.

There’s another community post with 404 debugging tips that might be helpful. Please give these solutions a try and let us know how it goes.

A human should be around soon to offer more advice. But you can also get helpful information quickly by asking v0.

1 Like

Hey Avik

I checked your repo out and everything looks great except your FastAPI directory is inside /app instead of at the root of the project, so Vercel isn’t seeing it

On a successful deploy you should see the python function listed below your build logs like this

Alternatively you can use vercel.json#functions to tell Vercel it should look in /app/api instead

3 Likes

Ok. Right now I have deployed it on a separate backend on AWS EC2.

Actually there is another questions I am wanting to ask,

https://aipptgenerator.vercel.app/api/ip

I have this API which is giving me the Ip but when the deployment of frontend is done, it is stick to the IP of the machine being used.

Now in the headers as well I couldn’t get the IP of the actual client who made the request.

Any idea on how to get it? I used @vercel/functions package as well for it but to no avail and also used normal headers X-forwarded-for others.

Edit: used the middleware as well suggested in new documentation, but didnt worked.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.