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 hosting
And 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.
Hello @marce1o ,
and welcome to the Community!
Based on the logs you've shared with us, it seems your firebase command is failing because of insufficient memory.
In this case, what usually helps is to increase the step size on your pipeline, as this will increase the value of allocated memory. Following is an example of how this can be configured in the pipeline step
pipelines:
default:
- step:
size: 2x # This step will be allocated 8GB of memory
script:
- echo "This step gets double the memory!"
You can find details of all the available step size and their respective memory/CPU allocation at the below article:
I hope that helps! Let us know in case you have any questions.
Thank you, @marce1o !
Patrik S
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.