#Vercel memory used excedeed
1 messages · Page 1 of 1 (latest)
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:
- Use the
functionsproperty within yourvercel.jsonconfig file. - Use a glob pattern to specify the path.
- Specify an integer defining the
memorysize 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:
- Configuring Memory and CPU for Vercel Functions (https://vercel.com/docs/functions/configuring-functions/memory)
- Choosing a Runtime - Memory size limits (https://vercel.com/docs/functions/runtimes)
- Troubleshooting Build Errors - Cancelled Builds due to limits (https://vercel.com/docs/deployments/troubleshoot-a-build)