"vercel dev" works, but in "vercel" it doesn't work

vercel dev
Vercel CLI 37.11.0
> Creating initial build
yarn run v1.22.22
$ nodemon
[nodemon] 3.1.7
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): src .env
[nodemon] watching extensions: js
[nodemon] starting `node api/app.js`
{"level":30,"time":1729541791838,"pid":15620,"hostname":"LAPTOP-5TP8FS6B","msg":"Listening on port 49199"}
{"level":30,"time":1729541791841,"pid":15620,"hostname":"LAPTOP-5TP8FS6B","msg":"STATE: Connecting to MongoDB"}
> Success! Build completed
> Ready! Available at http://localhost:3000

But with “vercel” or “vercel --prod”:

I’m using vercel.json:

{ 
  "version": 2,
  "buildCommand": "npm install"
}

I’ve already tried with:

"routes": [
    {
      "src": "/(.*)",
      "dest": "/"
    }
  ]

Or:
"rewrites": [{ "source": "/(.*)", "destination": "/api" }]

Same error.

Build Logs:

In Logs, nothing.

Dependencies:

"dependencies": {
        "@adiwajshing/keyed-db": "^0.2.4",
        "@whiskeysockets/baileys": "^6.7.8",
        "axios": "^1.1.3",
        "baileys": "github:whiskeysockets/baileys",
        "dotenv": "^16.4.5",
        "ejs": "^3.1.7",
        "express": "^4.18.2",
        "express-exception-handler": "^1.3.23",
        "link-preview-js": "^3.0.0",
        "mongodb": "^4.12.1",
        "mongoose": "^6.7.4",
        "multer": "^1.4.5-lts.1",
        "pino": "^8.7.0",
        "qrcode": "^1.5.1",
        "sharp": "^0.32.6",
        "uuid": "^9.0.0"
    },
    "devDependencies": {
        "eslint": "^8.28.0",
        "eslint-config-prettier": "^9.1.0",
        "husky": "^9.1.6",
        "lint-staged": "^13.0.4",
        "mocha": "^10.1.0",
        "nodemon": "^3.1.7",
        "prettier": "^3.3.3",
        "supertest": "^7.0.0"
    }

My structure:

Any idea?

Hey @mstreck. I know 404 errors can be tricky to solve. I would check the deployment output (can be found on the Source tab in deployment details). That will tell you the file structure for the deployment so you can see the path for each file on the site.

I wrote a 404 debugging guide with more tips. It looks like you might have already followed the Express.js deployment guide, but that’s also worth reading through if you haven’t already seen it. Please give these a try and let me know how it goes!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.