-
Notifications
You must be signed in to change notification settings - Fork 912
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
Node - this.f is not a constructor when calling firebase.auth() #1906
Comments
We have the exact same problem, but it only happens in the Node 10 runtime, not with Node 8. The It seems that the pre-installed version of Firebase in Node uses the |
I have the same issue. I use node 12.4.0 |
@Feiyang1 Auth breaks on Node starting from v6.2.1. It works in v6.2.0. Is there anything being changed since 6.2.1 that could cause this issue? |
The issue is likely due to this commit: 7866e22 They replaced: With: |
I am also getting the same issue. I am using firebase v6.2.2. Link to my question on stackoverflow |
The bug was introduced in v6.2.1. You can use the v6.2.0 as for now. We are working on a fix for this in #1909. And We will make a patch release ASAP. Thanks for report the issue. |
I'm not sure why but I'm also unable to use Firestore and Auth starting in 5.x. They keep showing that firestore/auth is not a function. 6.2.2 works for Firestore but auth returns the f not a constructor error. Thus, Firebase is completely unusable on my case for node js. |
New release 6.2.3 fix this issue. |
@rapomon this brings back my problem though of const functions = require('firebase-functions');
const firebase = require('firebase/app');
require('firebase/auth');
exports.app = functions.https.onRequest(async (req, res) => {
firebase.initializeApp({ ... });
await firebase.auth().signInWithEmailAndPassword(...);
res.send("Hello from Firebase!");
}); Again, I can trace back that problem for both firestore and auth all the way back to Firebase 5.x version. The version 6.2.2 fixes the issue for Firestore but Auth gets the |
I'm not using signInWithEmailAndPassword, I use signInWithCredential. Yesterday with version 6.2.2 gets the
|
This makes me wonder if the Node.js Client SDK actually works for Cloud Functions. Maybe it only allows the Admin SDK? Can you confirm this @bojeil-google ? My use case is I have an Ember app that I want to hook up to Cloud Functions for server side rendering. This should be similar to Angular Universal, just using Ember framework. |
The Node.js client SDK should work in a Cloud Functions environment. There are no restrictions on it based on environment. |
@mikebonnell There is a compatibility issue when using firebase js sdk and firebase-admin together. I provided a detailed explanation and workaround here - #1696 (comment) |
@Feiyang1 I'm not usinf Firebase Admin at all so I don't think that's the problem. @bojeil-google have you guys tried it out? Sure the issue for f constructor is gone but the auth library itself still isn't working for me. If any, the error was just replaces by something else. My code snippet is very simple. Please try deploying it on a Cloud Function running in Node 8. const functions = require('firebase-functions');
const firebase = require('firebase/app');
require('firebase/auth');
exports.app = functions.https.onRequest(async (req, res) => {
firebase.initializeApp({ ... });
await firebase.auth().signInWithEmailAndPassword(...);
res.send("Hello from Firebase!");
}); |
So it turns out that Firebase Admin is being implicitly initialized in Cloud Functions even if you're not using it. I was able to confirm this due to a small log when running locally. That same log doesn't show in Cloud Functions when it's already deployed. So what @Feiyang1 posted was actually the issue. Is there a benefit on why Firebase Admin is being implicitly initialized? I think this should be noted in the docs if it isn't yet. I also think that #1696 shouldn't be resolved just because the question was addressed. This is a bug and should be actually fixed. |
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
Steps to reproduce:
Simply calling
firebase.auth().signInWithEmailAndPassword()
in a Node environment doesn't work. This is for Firebase JS SDK, not Firebase Admin.Relevant Code:
Someone posted the issue in SO but I'm seeing the problem too on my side.
The text was updated successfully, but these errors were encountered: