Fixing serverless functions 404 errors in Vercel monorepo deployments

I’m experiencing a persistent 404 issue with my Vercel serverless functions. The build completes successfully, but no functions are being deployed or recognized.

Current Behavior vs Expected Behavior

Current: All API endpoints return 404 Not Found in preview deployment. The Functions tab shows no deployed functions, and no invocation logs appear in the dashboard despite successful build completion.

Expected: After deployment, serverless functions should be listed in the Functions tab, and API requests to /api/* routes should be routed to the deployed handler and return valid responses (currently they work perfectly in local development).

The Problem:

All API endpoints return 404 Not Found in the preview environment despite successful builds. The Functions tab shows no deployed functions, and there are no invocation logs.

Symptoms:

  • All API endpoints return 404 Not Found
  • Build completes successfully (47ms) with no errors
  • No function invocation logs appear
  • Local development works perfectly (npm run dev)
  • Functions tab is completely empty—no functions listed
  • Source tab shows successful build output

Code, Configuration, and Steps to Reproduce

Local Setup (Works Correctly)

cd packages/api
npm run dev
# API responds correctly at http://localhost:3000/api/*

Deployed Setup (Returns 404)
vercel.json:

{
  "version": 2,
  "buildCommand": "npm run build",
  "builds": [
    {
      "src": "dist/index.js",
      "use": "@vercel/node"
    }
  ],
  "routes": [
    {
      "src": "/(.*)",
      "dest": "/dist/index.js"
    }
  ]
}

Build Output:

Build command: npm run build
Output directory: dist
Build result: Successfully generates dist/index.js
Build time: 47ms (unusually fast—may indicate build skip?)

Steps to Reproduce

Push commit to GitHub (or manual deploy via vercel deploy)
Deployment completes successfully
Visit preview URL and access any /api/* endpoint
Receive 404 Not Found response
Check Vercel dashboard Functions tab—no functions listed

What I’ve Already Tried

  • Verified dist/index.js exists locally after npm run build
  • Tested with minimal handler (returns simple JSON)
  • Switched framework from Express to “Other”
  • Confirmed all environment variables are set in Vercel dashboard
  • Verified package.json in packages/api has correct build script
  • Ran npm run dev locally—API works perfectly
  • Checked Source tab after deployment—dist folder appears present

Project Information

Column 1 Column 2
Setting Value
Root Directory packages/api
Repository Type Monorepo
Project ID prj_zoVUHz7N4Yx2DvqjxXv6WP1QJlEu
Plan Hobby
Output Directory dist
Node Version 20+
Framework Other (Node.js API)
Deployment Method Git (GitHub)
Build Command npm run build

Environment Variables Configured

  • SUPABASE_URL
  • SUPABASE_ANON_KEY
  • SUPABASE_SERVICE_ROLE_KEY
  • DATABASE_URL
  • ENABLE_AI_ANALYSIS = false ✓

Build Logs

22:54:14.868 Running build in Washington, D.C., USA (East) – iad1
22:54:14.868 Build machine configuration: 2 cores, 8 GB
22:54:14.994 Cloning github.com/abdulfarasprojects/amanah-finance
22:54:17.009 Warning: Detected "engines": { "node": ">=20.0.0" }
22:54:18.408 Vercel CLI 50.4.10
22:54:18.547 WARN! Due to `builds` existing, Project Settings will not apply
22:54:18.622 Build Completed in /vercel/output [47ms]
22:54:20.661 Deployment completed

Key Observations & Questions

  1. Build Time Anomaly: 47ms build time seems unusually fast. Is the build being skipped or cached incorrectly?
  2. Warning Message: “Due to builds existing, Project Settings will not apply”—Does this indicate a configuration conflict between vercel.json and project settings?
  3. Missing Functions: Functions tab is completely empty. Does this suggest the build isn’t detecting/outputting serverless functions properly?
  4. Monorepo Routing: Is there a known issue with Root Directory (packages/api) affecting function discovery in monorepo setups?

Additional Context

  • Local development works perfectly with npm run dev
  • Build completes without errors
  • No TypeScript compilation errors
  • All dependencies install correctly
  • This is blocking preview deployments for a fintech application

Any guidance would be greatly appreciated!

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.

If you’re having trouble deploying an Express app, this guide can help.

You can also ask v0 for suggestions tailored to your own project setup.

This is now resolved.