0

I’m trying to deploy a Nuxt 4 full-stack app to Vercel, and while the frontend builds and loads correctly, all my backend API routes fail, and there is no response from the composables or server apis. This project works locally using the vercel preset using nuxt build --preset vercel and nuxt dev --preset vercel and using a node server it runs perfectly on Render using node .output/server/index.mjs.

On vercel, it builds without errors and only serves the frontend part, but the composables and server apis aren't used at all. My code for reference.

I am using the vercel preset for nitro which generates two folders static and functions in .vercel/output, where static should be hosted on vercel, which is correctly done, but none of the apis in the functions folder are registered as serverless functions.

Settings tried on Vercel:

  • Root directory: web
  • Build command: npm run build:vercel, npm run build
  • Output directory: .vercel/output, .output, .vercel (tried blank too)
  • Install Command: npm install
  • Development Command: npm run dev, npm run dev:vercel, (tried blank too)

package.json scripts

"scripts": {
    "build": "nuxt build",
    "build:vercel": "nuxt build --preset vercel",
    "dev:vercel": "nuxt dev --preset vercel",
    "dev": "nuxt dev --host 0.0.0.0 --port 3003",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },

in nuxt.config.ts, I have used

ssr: true,
nitro: {
    experimental: {
      websocket: true
    },
    preset: 'vercel'
  },

and set environment variables in Vercel dashboard.

Expected behavior

Vercel should detect and serve the backend API routes (/server/api/*) through Nitro’s serverless function, just like it works on Render or local preview, and I want a serverless approach to prevent winding down fully like in render (which delays requests by a minute or so).

Environment

  • Nuxt 4.1.3
  • Vue 3.5.22
  • Node v24
  • Vercel
  • SSR enabled
  • Works fine on Render

Question

Why does my Nuxt 4 project on Vercel deploy only the frontend with a single __fallback.func, and not register or serve any /api routes? Is there an additional configuration step required for Nitro server routes to work on Vercel?

Or is an entire Nuxt project (using composables and server apis and plugins) not deployable solely through serverless approach and needs a dedicated node server, which would mean my only solution is using Render?

1 Answer 1

1

All your routes will be served through that __fallback.func. What makes you think that they aren't being served? What happens when you access a route?

Sign up to request clarification or add additional context in comments.

2 Comments

It's currently deployed here, and the apis are meant to serve the stored files like dictionary, etc, so validation and app flow depends on it, for example the "word chain" path only shows 300 words (which are hard coded), while the api is meant to serve 35K from the dictionary.json file, similarly the validation for wordle also fails
not sure why my post is marked as unhelpful. 😆 the API endpoints are working fine, as you can see you are getting responses from https://word-games-rave.vercel.app/api/status?origin=wordchain if you're getting errors on the other APIs, then that's likely a bug in your code (or maybe a limitation of your function size). the issue isn't that the API route isn't deployed - it's something else which I can't tell without seeing your error logs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.