Recently my Bitbucket pipeline started failing the "firebase deploy" command with "JavaScript heap out of me".
This is basically the script:
export FIREBASE_CREDENTIALS="${FIREBASE_CREDENTIALS}"
export GOOGLE_APPLICATION_CREDENTIALS="firebase-credentials.json"
apt-get update && apt-get install -y curl jq
curl -sL https://firebase.tools | bash
echo "$FIREBASE_CREDENTIALS" > firebase-credentials.json
PROJECT_ID=$(cat .firebaserc | jq -r '.projects.default')
firebase use --add "$PROJECT_ID"
firebase deploy --only hostingAnd this is the full error:
<--- Last few GCs --->
[370:0x4562350] 728369 ms: Scavenge (reduce) 2044.2 (2082.3) -> 2043.3 (2082.3) MB, 2.00 / 0.00 ms (average mu = 0.308, current mu = 0.345) allocation failure;
[370:0x4562350] 728373 ms: Scavenge (reduce) 2044.2 (2082.3) -> 2043.3 (2082.3) MB, 1.92 / 0.00 ms (average mu = 0.308, current mu = 0.345) allocation failure;
[370:0x4562350] 728376 ms: Scavenge (reduce) 2044.2 (2082.3) -> 2043.3 (2082.5) MB, 1.64 / 0.00 ms (average mu = 0.308, current mu = 0.345) allocation failure;
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----
1: 0x9c6f1d node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/usr/local/bin/firebase]
2: 0x15a3720 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/usr/local/bin/firebase]
3: 0x15a3a07 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/usr/local/bin/firebase]
4: 0x17b5de5 [/usr/local/bin/firebase]
5: 0x17b6374 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/usr/local/bin/firebase]
6: 0x17cd254 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) [/usr/local/bin/firebase]
7: 0x17cda6c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/firebase]
8: 0x17a3d91 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/firebase]
9: 0x17a4f25 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/firebase]
10: 0x1782576 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/firebase]
11: 0x1bddc96 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/firebase]
12: 0x1feaef6 [/usr/local/bin/firebase]
Any ideas of how to solve it or why this only started happening now? I tried adding
export NODE_OPTIONS="--max-old-space-size=4096"
but it did not work.
Thank you.