angularfire: SSR mode: This operation is not supported in the environment this application is running on. "location.protocol" must be http or https and web storage must be enabled
Version info
Angular: 9.1
Firebase: 7.13.2
AngularFire: 6.0.0
Other (e.g. Ionic/Cordova, Node, browser, operating system): The error happens when running ng run <project>:serve-ssr
on local OS (Mac or Windows) However it seems that auth still works. So maybe this should be a warning and not an error? We can still login and everything works fine.
How to reproduce these conditions
Run Angular in SSR mode (using Nest)
Steps to set up and reproduce
I’m not really sure how to reproduce this. I believe it started appearing in our logs when we first implemented AngularFireAuth.
Debug output
** Errors in the JavaScript console **
** Angular Universal Live Development Server is listening on http://localhost:4200, open your browser on http://localhost:4200 **
Auth Failed [u [Error]: This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.] {
code: 'auth/operation-not-supported-in-this-environment',
a: null
}
** Output from firebase.database().enableLogging(true);
**
No output shown.
Expected behavior
Not to see the error in the log.
Actual behavior
Error in log. But nothing seems to be broken. Should this be a warning instead?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 4
- Comments: 15 (4 by maintainers)
After updating from 6.0.2 to 6.0.3 I am no longer able to open my Ionic/Capacitor app on iOS and get the same error. I had to roll back to 6.0.2 for it to work again.
@jamesdaniels Same for me - My Ionic/Capacitor app fails to load with the same error after using 6.0.3 (actually
6.0.3-canary.77a9a15
since I was trying to get the Analytics issue fixed). Loaded fine in 6.0.2. Hard to say what happened in 6.0.3 that’s causing this.Amazingly, if I set
server.iosScheme
in capacitor.config.json tochrome-extension
, the app loads perfectly fine.I do encounter the exact same issue after upgraded to 6.0.3.
I have the same error in a newer version of Firebase
https://github.com/angular/angularfire/issues/3181
Anything helps
@jamesdaniels Im in version 7 of angularfire. I have the same issue. The browser and server build and the ssr server starts fine. but when a page is requested. then the ssr server has an error.
so i looked into the
_getInstance
mentioned in the callstack it takes an arg should be a class instance hence the error. Here is what it looked like in my ssr bootstrapThe log i added (see above) revealed that an error instead of a class was passed in the 3rd time. see out put below
of course all my servers and test requests are on local host… Do you know anything that can help me understand either error
Thanks for confirming, I don’t have an Ionic app handy to test in. Will cut
6.0.4
final later today.Ah! I think I know what this is, I added an await for getRedirectResult to reduce thrashing on the observable, which is probably unsupported outside of the browser. I have a work around in mind. I’ll address in a patch soon.