Clarification on manually deploying NextJS sites

Hi again!

Here is my site name:

I’ve read through this post, and it’s sort of what I’m after besides the static export, but there are a few things that I can’t really find answers for regarding the build process for NextJS on Netlify.

  1. The docs for @netlify/plugin-nextjs say to use the netlify deploy --build command. Is this all that’s needed to deploy a Next site manually? Was the more complex configuration in the above link just because it was a Next static site?

  2. I’m using Netlify Forms on this site. Will all forms still be auto detected for manual deploys using netlify deploy or is there a configuration associated with forms?

I love Netlify’s build system, but have recently ran into the Command failed with exit code 137: npm run build error. My site is small, but has quite a bit of images with placeholder blurs being generated at build time, so I figure that’s what is causing the issue.

I’m in the process of using the Docker image to troubleshoot more, but until I can really dive into that, I wanted to make sure I can still publish the site by doing a local build and manually deploying.

I believe that’s it for now, thank you for the help!

Hi @crcollver ,

  1. Yes netlify deploy --build is the only command needed to deploy a Next.js site manually.
  2. Netlify forms will still work even with manual deploys as long as you have the plugin installed + configured in your netlify.toml file

Code 137 means you ran out of memory. You can upgrade but you’ll have to pay for it. Perhaps you can try to increase your memory limit in your netlify.toml file? Finally, I recommend you give a look at this resource as it may answer any outstanding questions you have.

1 Like

Hi there @SamO, thank you for answering my questions!

By increasing the memory limit in my netlify.toml file I assume you mean adding an environment variable sort of like this: NODE_OPTIONS = "--max_old_space_size=4096". I was under the impression that with a code 137 OOM error, that this won’t do much as it seems like the flag mostly helps with the Javascript heap out of memory instead.

Is there another way to limit/increase memory usage that I’m not aware of? I’m worried that if I upgrade Netlify to get more resources, I may be in the same boat later on when my site grows. I haven’t had the time to dive into profiling my build command’s resource utilization!

I’m not seeing any failed deploys for your staging branch - maybe you deleted those? Without checking the error, we can’t comment much on its details.

I apologize, I linked my staging branch deploy on accident. The most recent failure in my logs is the one that encountered the error. I believe I removed the others that occurred, but they all occurred around the 40 page mark for my site. It is the standard “Killed” Command failed with exit code 137 error that I’ve seen on a few other posts here.

I have since tried the --max_old_space_size suggestion and have done a few builds without issue so far. It seemed like I was only ever able to get a successful build if I manually triggered it.

Ah yes, if you’re getting the Killed message that can’t be solved by increasing the heap size. On Starter you get 8 GB RAM, on Pro and above, you get 11 GB. Not a lot extra, but it can get the job done if you need barely extra memory (like 9 GB).