-
Notifications
You must be signed in to change notification settings - Fork 930
4.13.0 & 4.13.1 JavaScript heap out of memory on prod build #714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@chinib I have just run into this and I proved it is happening by reverting to a commit 36 hours ago that I built and deployed to production successfully. I have literally. OH MY GOD painstakingly gone through all 996 of my dependencies (yes you read that right!!) and checked which have changed in the last 24 hours. 😵 Firebase is the only one. How did I notice? I turned webpack on full blast and took note of when it just.... stopped. It just stops and memory goes through the roof. I have tried giving Node 12GB of memory and it even blasts through that. Not sure what changed in 4.13.1 but thank you @chinib for finding this - will revert to 4.12.1 for now and remove the carat from my package.json!! |
We seems to have ran into the same issue. This is basically a show-stopper for our Ionic prod builds. |
I am facing the same issue since the Firebase 4.13.0, and the issue is still present in the 4.13.0 and 4.13.1. The app-scripts build of Ionic, when running in Prod, is running forever at the "webpack" step. It is working juste fine with firebase <= 4.12.1 |
Funny part is that I NEED this update, it has a fix for https://firebase.google.com/support/release-notes/js#4.13.0 Error occurs but login is still successful. I believe this version fixes this issue... hopefully the amazing team can get a new version out soon that can build :) |
Downgrading to [email protected] wasn't enough for me. Had to make sure I was using @firebase/[email protected] too. This was preventing me from making an AOT build. |
Confirming that downgrading to [email protected] worked for me. Feel free to look at this repo for an example of an affected app. |
This issue still persist on [email protected] / [email protected] - Does anyone has a workaround (except downgrading to [email protected])? UPDATE: The information of @moomoomamoo was the right one! I removed @firebase/[email protected] (which is installed with [email protected]) and replaced it with @firebase/[email protected] from [email protected] and NO memory heap :) I will check tomorrow what changed there. |
It works for me with firebase 4.12.1 Thank you very much!!!! |
@paulstelzer any luck finding something in @firebase/[email protected] ? |
@chinib I find out that I load the Firebase Database althought I not used it - so I removed loading it and so I not get the error anymore. But if you need the package and the heap out of memory error occurs, then you have to use the older version of firebase@database |
Same here, you can use firebase ^5.0, but you need ton install @firebase/[email protected]... |
Thanks @tgensol. Adding @firebase/[email protected] to @chinib's solution worked for me. |
Confirming that this is still an issue with 5.0.4. |
Same issue. I'm using firebase 5.0.4... |
Bit disappointing to see there's no real reaction to this case by Firebase folks. What gives? |
Just another comment, pointing out that some have been able to solve this using firebase 5.0.x, but you need ton install "@firebase/database": "0.2.1". |
Could be cool to understand what changed between @firebase/[email protected] and @firebase/[email protected] and is still here. (And causing this error)... |
@tgensol hint worked for me. ionic cordova build android --prod --release |
Confirming that this is still an issue with 5.1.0. I had to use the older "@firebase/database" to be able to run a prod build as well, it is working with this set of packages, even though it is not recommended to reference the standalone packages directly it seems to work so far.
|
Still an issue with firebase 5.2.0... @mikelehen or anybody from firebase could look at it ? (or at least say something please :( ) ? Thanks ! |
Sorry nobody's looked at this. I hadn't seen it since there were no labels on it, and I mostly only monitor Firestore or Database issues. This sounds very strange. I am not sure why our (working) JavaScript code would be causing the ionic build to run out of heap and crash. My instincts say this is really an ionic issue which we are accidentally triggering. It looks like @jshcrowthe did a large-ish build refactoring between 4.12.1 and 4.13.0 and so that seems likely to be related. But like I said, it's very possible we're not doing anything "wrong"; it's just that we've triggered poor memory patterns in ionic somehow... or exceeded some threshold. I see there's a related ionic issue over here. It may be worth looking through that for potential workarounds, though it doesn't seem to be resolved either. I'm not sure the best way to move forward on this. Ideally somebody from ionic could use a memory profiler to see what the build is doing and why it's running out of heap. Failing that, somebody could experiment with piecing apart Josh's build refactor commit to see if we can isolate what exactly triggered the regression. But that could be slow and painful, and perhaps not very fruitful (it may still not tell us what's actually going wrong in ionic). Sorry I don't have anything more concrete to contribute at this point. This looks like a gnarly issue and may be difficult to tackle from the Firebase side. :-/ |
Just in case this helps anyone in trying to debug this: For me (and a few others here), the issue occurs when using any higher than |
@bnfrnz Thanks. Downgrading to @firebase/[email protected] does help solve the issue in --prod compile. |
Version 5.3.0 still facing the same issue. |
I updated the @angular-devkit/build-optimizer which @ionic/app-scripts leverages with version 0.0.35, for app-scripts version 3.1.8 and I updated @angular-devkit/build-optimizer to version 0.6.8. Now I can do a production build with ionic 3.9.2 and firebase 5.3.0 |
Thanks @jayordway! This seems to finally do the trick for me as well. |
@jayordway I tried but I am getting typescript error. What is your version for typescript and angular ? And are you using only @ionic/[email protected] ? It is not working with @ionic/[email protected] ? Thanks ! |
After adding angular-devkit/build-optimizer, I also ended up getting a typescript error when ngc starts...
My application's package.json includes:
and also...
The reason why I use typescript 2.7.2, is because angular 6.0.9 doesn't support typescript 2.9.2. Initially, my application's package.json did not have any reference to @angular-devkit/build-optimizer. But with just these packages mentioned above, it builds fine. However, just like everyone else, when I upgraded @firebase/database 0.2.1 to 0.3.4, I get a build error message regarding JavaScript heap out of memory. This only happens if I include --prod or --optimizejs flag. So, based on the latest comments, I simply added a reference in my own application's package to angular-devkit/build-optimizer by running:
Then I run the same build again (including the same --prod flag), I get the typescript error mentioned above. |
@SteveKennedy Same here. That's why I asked @jayordway for more informations about his package.json |
This is an excerpt of my package.json with the libraries that I think may be relevant here:
There seem to be a few people out there with the error that you're seeing. Some assume that it's related to the angular aot. I can't really help because I don get the error. The only two things I wonder -- and these may or may not at all be related to your issue -- are the following:
After that, you should simply see
Again, I'm not sure any of this is related. But good luck! |
I have to agree with @bnfrnz here. Ionic projects generated from scratch come with angular/core 5.2.11. So I am not sure if these newer versions of angular and typescript will mesh so well. Here is a list of some of my dependencies: "@angular/animations": "5.2.9", "devDependencies": { |
I originally opened this issue on the Here is my working answer for the issue. It fixed it for myself, but as we all know. A solution for some may not be a solution for many. |
I was able to get my project working by adding keystore passwords to the cli. Like this: ionic cordova build android --prod --release -- -- --keystore="..\android.keystore" --storePassword=password --alias=alias --password=password |
As @mikelehen says, I think Firebase is not the root cause.
Below is an excerpt of
|
@alclimb 's solution didn't work for me. Maybe there's something more. |
@alclimb It works for me, but with the latest version (0.8.3) in this case. Thanks. In my case, I'm building a PWA (not Android or iOS). And the issue started when I installed @angular/fire which uses firebase. but It can be a coincidence. |
I've found a solution when using Ionic which was pointed out in an old message on the forum: https://forum.ionicframework.com/t/3-7-0-ios-build-with-prod-not-working/107061/24 Open Change the first line from: I tried values 1024 and 2048, but for my relatively large app I needed 4096. Now I am able to run |
For any future readers, my issue is that I had the firebase (5.5.3) package installed and did not properly import the specific modules. The fix is shown here: #848. I guess importing everything was much too large. |
@basvdijk I can confirm that your solution worked for me. Thanks! |
@alclimb 's solution works for me |
only add "@firebase/database": "0.2.1", for your package.json, and works. |
this worked perfectly, thank you very much |
Thanks! @JNSantiago Regards |
[REQUIRED] Describe your environment
Using firebase within a ionic Android & Ios app. Ionic details:
global packages:
local packages:
System:
[REQUIRED] Describe the problem
ionic serve & ionic build run fine, without any problems.
ionic cordova build ios --prod
Throws: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
Steps to reproduce:
This only occurs (everything else being equal) after
npm install [email protected]
ornpm install [email protected]
npm instal [email protected]
resolves this problem (workaround).also
node --max-old-space-size=8192 /usr/local/bin/ionic cordova build ios --prod
gives the same error.Which makes me believe there is a memoryleak somewhere introduced in 4.13.0, I've reproduced it with a minimal code example using android (so even ppl without a mac can test).
If you require more information let me know, I am happy to assist.
The text was updated successfully, but these errors were encountered: