79637925

Date: 2025-05-25 17:40:31
Score: 0.5
Natty:
Report link

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.

Reasons:
  • Whitelisted phrase (-1): Have you tried
  • Long answer (-0.5):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Arthur Belanger