next.js: Serverless out of memory

I’m trying to test and deploy serverless version of nextjs, with serverless framework. At the build phase, this error below occurs :

<--- Last few GCs --->

[29376:0000025DFBC3CCB0]    63127 ms: Mark-sweep 1381.4 (1405.6) -> 1381.4 (1405.6) MB, 278.3 / 0.0 ms  (average mu = 0.114, current mu = 0.000) last resort GC in old space requested
[29376:0000025DFBC3CCB0]    63367 ms: Mark-sweep 1381.4 (1405.6) -> 1381.4 (1405.6) MB, 239.8 / 0.0 ms  (average mu = 0.061, current mu = 0.000) last resort GC in old space requested


<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 00000364E0CD0461]
    1: StubFrame [pc: 00000364E0CC69CB]
Security context: 0x012951a1d949 <JSObject>
    2: replace [0000012951A0F4E9](this=0x03813c38af09 <Very long string[4785407]>,0x018ac81410f9 <JSRegExp <String[18]: [<>\/\u2028\u2029]>>,0x018ac8141171 <JSFunction escapeUnsafeChars (sfi = 00000294E35792D9)>)
    3: default(aka serialize) [00000294E35797F1] [C:\Users\Romain\Documents\GitHub\front\node_modules\nex...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: 00007FF78C2FD50A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4618
 2: 00007FF78C2A4F86 uv_loop_fork+79446
 3: 00007FF78C2A5C21 uv_loop_fork+82673
 4: 00007FF78C7ACAEE v8::internal::FatalProcessOutOfMemory+798
 5: 00007FF78C7ACA27 v8::internal::FatalProcessOutOfMemory+599
 6: 00007FF78CA85844 v8::internal::Heap::RootIsImmortalImmovable+14788
 7: 00007FF78CA83608 v8::internal::Heap::RootIsImmortalImmovable+6024
 8: 00007FF78C6440DB v8::internal::Factory::AllocateRawWithImmortalMap+59
 9: 00007FF78C646B5D v8::internal::Factory::NewRawTwoByteString+77
10: 00007FF78CA344A3 v8::internal::Smi::SmiPrint+483
11: 00007FF78C6414A3 v8::internal::CompilationJob::operator=+1155
12: 00007FF78CC62AAA v8::internal::VectorSlotPair::index+263610
13: 00000364E0CD0461

To Reproduce

My repo is pretty complex, but should be stable : https://github.com/CuistotduCoin/front (yarn build) I will try with a simpler version

System information

  • OS: Windows,
  • Version of Next.js: 8.0.1

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18 (12 by maintainers)

Most upvoted comments

I don’t think it’s a leak btw, it’s just using a massive amount of resources to minify your pages 😄 Though I’m very willing to investigate this further, I have some plans for that already 👍