Have you tried moving your index.ts file up one level? replace : pages/api/v1/wallet/expenses/[id]/index.ts with: pages/api/v1/wallet/expenses/[id].ts
Commit and push the changed route, trigger the Vercel deployment and re-check the route: https://balance-it.vercel.app/api/v1/wallet/expenses/akshat This should give 200 or expected handler response. Not 404 or 405.
This aligns with Vercels actual function mapping, serverless routing consistency.
Vercel does not reliably resolve dynamic API routes defined as /[param]/index.ts. Flattening the dynamic segment (to [id].ts) resolves the issue. This works with versions of next.js 12 - 15 and is common when deploying to Vercel.