Dynamic routing is working on localhost but not on Vercel

I have an API that loads test questions like this:
const response = await fetch(/api/study/questions/${testId}?limit=${settings.questions});

File location: src\routes\api\study\questions\[id]\+server.ts

On localhost, that API returns a response. On Vercel, it started returning a 404 less than a week ago.

It’s visible in the build logs:
.svelte-kit/output/server/entries/endpoints/api/study/questions/_id_/_server.ts.js

It’s visible in the resources tab for the build:
[/api/study/questions/[id]](/route/%2Fapi%2Fstudy%2Fquestions%2F%5Bid%5D?environment=all) IAD1 Node 22 2.66 MB

What’s happening is the dynamic routing is being interpreted literally:

  1. https://cloudjobs.io/api/study/quiz/[id] - 200

  2. https://cloudjobs.io/api/study/quiz/az305 - 404

First, was there a change that caused this? Because this was working fine until recently. Second, what changes do I need to make to get Vercel to recognize the dynamic routes?

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.