Can't host serverless functions and API routes at the same time

Hi - I’m attempting to deploy a Next.js app on Vercel with both Vercel Go serverless functions - and API routes.

This is my folder structure:

Under /api I have a list.go function with a Handler function. Per the documentation, this should be queryable at /api/list - and it is.

Under /src/app/api - I have ./auth/[...nextauth]/route.ts which is my next-auth handler code. I expect this to be queryable at /api/auth/*.

When I deploy this on Vercel - or when I run it locally with vercel dev - I get a 404 on all paths under /api/auth. When I remove the root /api folder, it works fine.

Is there a way to get both serverless functions and API routes to work at the same time?

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.

Hi, Daniel!

Thanks for your patience with us :pray:

Did you manage to get a solution for this? I’m sure the community will find it super helpful if you did :smile:

No :confused: I actually ended up migrating my POC off of Vercel because of this limitation, it introduced too much friction

As an aside, I tried answering your comment with an email, as prompted here:

But got this error:

These are the email details: