adonisjs / mail

AdonisJS Email Provider
MIT License
102 stars 32 forks source link

Build is failing: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory #66

Closed moneychaudhary closed 3 years ago

moneychaudhary commented 3 years ago

The build process is throwing this error:

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb12b40 node::Abort() [/home/ubuntu/.nvm/versions/node/v16.1.0/bin/node]
 2: 0xa2fe25 node::FatalError(char const*, char const*) [/home/ubuntu/.nvm/versions/node/v16.1.0/bin/node]
 3: 0xcf946e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/home/ubuntu/.nvm/versions/node/v16.1.0/bin/node]
 4: 0xcf97e7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/home/ubuntu/.nvm/versions/node/v16.1.0/bin/node]
 5: 0xee3875  [/home/ubuntu/.nvm/versions/node/v16.1.0/bin/node]
 6: 0xee43bc  [/home/ubuntu/.nvm/versions/node/v16.1.0/bin/node]
 7: 0xef22f1 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/home/ubuntu/.nvm/versions/node/v16.1.0/bin/node]
 8: 0xef584c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/home/ubuntu/.nvm/versions/node/v16.1.0/bin/node]
 9: 0xec1dfb v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/home/ubuntu/.nvm/versions/node/v16.1.0/bin/node]
10: 0x122adbb v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/home/ubuntu/.nvm/versions/node/v16.1.0/bin/node]
11: 0x160c599  [/home/ubuntu/.nvm/versions/node/v16.1.0/bin/node]
Aborted (core dumped)

I think it is happening because we are importing the whole AWS SDK here: https://github.com/adonisjs/mail/blob/3921b8359eae0b7e44fe7d6d3a682564f83ca79c/src/Drivers/Ses.ts#L12

I think it can be fixed by importing the necessary code only. For reference: https://github.com/aws/aws-sdk-js/issues/2683#issuecomment-826383666

Package version

7.1.1

Node.js and npm version

v16.1.0 and 0.35.1

thetutlage commented 3 years ago

Not sure how importing a package can eat all the memory?

thetutlage commented 3 years ago

Closing since not actionable