#Vercel memory used excedeed

1 messages · Page 1 of 1 (latest)

atomic birch
#

Hey, i use NextJS and Vercel, i have a problem of the limitation of memory
It's only 1024 Mb and my program reach this limit, after there is a crash
How can i do for change the limitation ?

keen willowBOT
#

Hi @atomic birch. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

You can adjust the memory size for your Serverless Functions on Vercel by configuring it in the vercel.json config file. Here are the steps to do it:

  1. Use the functions property within your vercel.json config file.
  2. Use a glob pattern to specify the path.
  3. Specify an integer defining the memory size in MB for your Serverless Function (between 128 and 3009).

Here is an example of how to set it in your vercel.json:

{
 "functions": {
 "api/test.js": {
 "memory": 3009
 },
 "api/*.js": {
 "memory": 3009,
 "maxDuration": 30
 }
 }
}

In this example, the memory for the function at api/test.js and all functions matching api/*.js is set to 3009 MB.

Please note that the maximum memory for a Serverless Function is 1024 MB on a Hobby plan, and up to 3009 MB on Pro and Enterprise plans. If you're on a Hobby plan, you might need to upgrade to increase the memory limit.

Also, remember that any custom memory size set in the vercel.json file will take precedence over the default memory size set in the dashboard.

If you're still encountering memory issues, you might need to optimize your code or dependencies to reduce memory usage. You can use a package size checker tool like bundle to check the size of a package and search for a smaller alternative.

Sources:


Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: