FATAL ERROR during 'Deploy your serverless infrastructure'

My react app is now quite different form the example scratch app after editing and building a number of different APIs and successfully deploying them through the CLI.

When I try to run serverless deploy -v through GitBash in Windows I get the following response;

$ serverless deploy -v
Serverless: DOTENV: Loading environment variables from .env:
Serverless:      - SAMPLE_ENV_VAR
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF6980F094F napi_wrap+124431
 2: 00007FF698092696 v8::base::CPU::has_sse+34502
 3: 00007FF698093356 v8::base::CPU::has_sse+37766
 4: 00007FF698896F4E v8::Isolate::ReportExternalAllocationLimitReached+94
 5: 00007FF69887EF91 v8::SharedArrayBuffer::Externalize+833
 6: 00007FF69874C85C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1436
 7: 00007FF698757C00 v8::internal::Heap::ProtectUnprotectedMemoryChunks+1312
 8: 00007FF698754734 v8::internal::Heap::PageFlagsAreConsistent+3204
 9: 00007FF698749FC3 v8::internal::Heap::CollectGarbage+1283
10: 00007FF6987493B4 v8::internal::Heap::CollectAllAvailableGarbage+196
11: 00007FF69874880F v8::internal::Heap::AddRetainedMap+2479
12: 00007FF698770623 v8::internal::Factory::NewRawOneByteString+83
13: 00007FF698465EC3 v8::internal::StringStream::ClearMentionedObjectCache+10467
14: 00007FF6984B67E8 v8::internal::DeclarationScope::was_lazily_parsed+48648
15: 00007FF6984AFBE0 v8::internal::DeclarationScope::was_lazily_parsed+20992
16: 00007FF6984B03AF v8::internal::DeclarationScope::was_lazily_parsed+22991
17: 00007FF698CC2C6D v8::internal::SetupIsolateDelegate::SetupHeap+567949
18: 00007FF698CFECAA v8::internal::SetupIsolateDelegate::SetupHeap+813770
19: 00007FF698CAF815 v8::internal::SetupIsolateDelegate::SetupHeap+489013
20: 000001F1B47890A9

I am unsure where to begin with this issue so any help is appreciated.

Hmm usually out of memory errors happen with serverless-webpack or in our case the serverless-bundle plugin. Are you using either?

This is in my package.json;

"devDependencies": {
    "aws-sdk": "^2.576.0",
    "serverless-bundle": "^1.2.5",
    "serverless-dotenv-plugin": "^2.1.1",
    "serverless-offline": "^5.3.3"
  },

So I assume, yes I am using serverless-bundle? Is this incorrect?

Thanks

@jayair any follow up on this?

The out of memory errors from serverless-webpack is a little common. How many functions do you have? To get around this you can disabling this in your serverless.yml.

package:
  individually: true

Great tutorial. I have been following along with no issue. Only purposeful deviation is a unique server name and using yarn rather than npm. While deploying via seed I get this error, “FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory.” Any advice?

UPDATE: fixed issue by setting env variable key: NODE_OPTIONS and value: --max-old-space-size=8192. Not sure if this is correct solution?

Oh that’s weird. How much memory was Node using by default?