-
Notifications
You must be signed in to change notification settings - Fork 924
Angular with SSR firebase bug #1754
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
I found a few problems with this issue:
|
Thanks for reporting the issue! We didn't consider SSR use case when adding the condition. We will fix it in the next release. Can you please downgrade firebase to <= 5.10.0 as a workaround? |
/var/www/html/project-name/dist/server.js:102897 I'm also Facing the same issue after I updated the packages |
Why is this closed? |
Github automatically closed it when I mentioned it is fixed in #1757. Reopening it till it's released. This check is only added in 5.11.0, so previous versions should work, or you are facing a different issue. |
Thanks for your clarification. Is there a way I can use the fix in #1757 before release if it is going to take a while to release? |
You can use |
Thank you very much. var major = parseInt(firebase_app__WEBPACK_IMPORTED_MODULE_6__["SDK_VERSION"].split('.')[0]); TypeError: Cannot read property 'split' of undefined |
Found a temporary solution in case others are interested too. then install older version, I did below: Everything worked after this. |
6.0.2 is out with the fix. @mezzo9 is the following code snippet from your code? I did a search and it is not in firebase source code. Could you open a new issue if it's different than the reported issue in this thread? |
@mezzo9 I am also facing this issue, found a solution? Hi @Feiyang1 , that particular line cannot be exactly found in the source code. However, I can see the property SDK_VERSION being used all over the code. Perhaps there's something wrong when this property was handled by webpack? (I don't know what I am saying but thanks for helping us out in this issue) |
I am also facing the same issue...
|
That's really weird. Can you create a repro and share it? |
@dasmeet, The only solution that worked for me is to use an old version.
|
Thanks @mezzo9. That works. Unfortunately that version has some errors with Cloud Messaging. But that's not important for me right now. |
Hi @Feiyang1, I just saw this warning during an SSR build of our app.
Checking the firestore.js file, it actually expects an SDK_VERSION property
Is that property should not be importable? |
Okay. The problem is that webpack read the file pointed by The workaround is to force webpack to read the file pointed by the module.exports = {
...
resolve: {
alias: {
['firebase/app']: path.resolve(__dirname, 'node_modules/firebase/app/dist/index.cjs.js')
}
}
...
} The discrepancies between the esm build and cjs build is currently a limitation in firebase packaging and type definition. I will take it to the team and see how we can fix it. It is probably a breaking change, so we also need to think about the timing. A workaround can also be applied at @angular/fire, so you guys don't need to do anything. I think it's probably the best (temporary) solution at this time. Once I have some progress with @angular/fire solution, I will link it here. |
Even after upgrading to 6.0.2 , still self of undefined error comes up on Angular SSR build. Build succeeds but error comes when you try to run the local server post build |
6.0.2 doesn't work for me too. Can someone please paste a sample config which is working. Tried with the module.exports solution suggested above too. |
I am getting the same issue, i would appreciate if someone can explain how can we fix it with an example. |
How I solved it Find the npm package where this line was getting bundled from In my case it was |
@Feiyang1 fix worked for me |
var major = parseInt(firebase_app__WEBPACK_IMPORTED_MODULE_6__["SDK_VERSION"].split('.')[0]); TypeError: Cannot read property 'split' of undefined |
@Feiyang1 adding that workaround to the webpack works, and at the moment allows me to build:ssr. Although, when a fix is made, will I need to take workaround out? |
It didn't show a build error but in Cloud Run deployment, there is a problem. |
@stot3 no, you don't have to take it out, but you can. The new error you encounter sounds like a different error than the original issue. Can you please open a new issue with steps to reproduce? |
HI @Feiyang1 I'm also facing same issue what @stot3 has mentioned. Please check this [https://github.com//issues/1797] (link) for more detail. I'm also facing same IDBIndex reference issue. |
We have made the fix for the "SDK_VERSION" issue in @angular/fire angular/angularfire#2079 Once it is released, you won't need the workaround mentioned in #1754 (comment) |
There is a bug with [email protected]
When install last version of firebase getting error on my server:
With version 5.7.3 works fine.
I am using Angular 7 with server side rendering and @angular/fire": "^5.1.3" pkg as well.
The text was updated successfully, but these errors were encountered: