Muhammad Mahmoud
Muhammad Mahmoud

Reputation: 949

Deploying Nuxt SSR Universal App on Vercel serverless function

I'm trying to host a universal ssr app built with nuxt 2 on vercel.

Here's the Project Repo, The project total size is about 6mb

But when i try to build vercel it gives this error

Error: The Serverless Function "index" is 124.58mb which exceeds the maximum size limit of 50mb. Learn More: https://vercel.link/serverless-function-size

a screenshot of the error

Vercel Error

Upvotes: 1

Views: 1418

Answers (2)

Andre Yañez
Andre Yañez

Reputation: 31

I know it's been some months since the question was answered but I wanted to contribute as well, having finished the same Nuxt course as well.

I changed the vercel-builder version to 0.22.1 as proposed on this issue on github: https://github.com/nuxt/vercel-builder/issues/633

{
  "version": 2,
  "builds": [
    {
      "src": "nuxt.config.js",
      "use": "@nuxtjs/[email protected]",
      //...
    }
  ]
}

As for November 2022 this solved the issue.

Upvotes: 3

kissu
kissu

Reputation: 46761

Nothing more to add here, a serverless function is meant to lightweight and with a very few dependencies.

While a Nuxt2 app comes with node modules and a lot of things. This is not the correct usage of a serverless function.

Also, if you're using ssr with target: 'server', you will need a node.js instance running anyways, so Vercel does not fit either. Something like Heroku is more adapted.
If you only use SSG (`target: 'static'), it may be fine.

Upvotes: 0

Related Questions