Skip to content
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

user.create not being triggered when using passwordless email login. #226

Closed
Bengejd opened this issue Apr 12, 2018 · 12 comments
Closed

user.create not being triggered when using passwordless email login. #226

Bengejd opened this issue Apr 12, 2018 · 12 comments

Comments

@Bengejd
Copy link

Bengejd commented Apr 12, 2018

Version info

"firebase-admin": "^5.12.0",
"firebase-functions": "^1.0.0",

Steps to reproduce

Create a firebase function that gets triggered on.create(), use the firebase passwordless email auth, authenticate into your application,

Were you able to successfully deploy your functions?

Yes

Expected behavior

Function runs on user.create() function.

Actual behavior

The function doesn't get triggered.

@rjhuijsman
Copy link
Contributor

Thanks for the report! We're working on resolving this; stay tuned!

@valmassoi
Copy link

    "firebase-admin": "^5.12.0",
    "firebase-functions": "^1.0.1",

Same issue. The trigger was working in "firebase-functions": "^0.8.1"

@laurenzlong
Copy link
Contributor

@valmassoi If you reverted your SDK version, does it work again?

@valmassoi
Copy link

Yep @laurenzlong I just reverted and it works again (but I'd like to get on v1 asap):

$ yarn add firebase-functions@0.8.1 -E
# undo migration guide code changes
$ date && firebase deploy --only functions:createUser

Also note when I was on 1.0.1 the functions.auth.user().onCreate trigger would still work for new email/password users - just not my GitHub/Gmail providers

@laurenzlong
Copy link
Contributor

@valmassoi Could you share your code for both v0.8.1 and v1.0.1 versions? They're both targetting the same backend so I'm very confused as to why the SDK version would affect whether the function gets triggered.

@valmassoi
Copy link

@laurenzlong

// v1.0.1
export const createUser = functions.auth
    .user()
    .onCreate(async (userRecord, context) => {
        const { uid, email, displayName } = userRecord
        const [firstName, lastName] = displayName ? displayName.split(' ') : ['', '']
        const newUserRecord = {
            uid,
            email,
            firstName,
            lastName,
            qualificationRecord: {
                kyc: "Incomplete",
                accreditation: "Incomplete",
            }
        }
        const userDocRef = admin.firestore().collection('users').doc(email)
        await userDocRef.set(newUserRecord)
        return
})
// v0.8.1
export const createUser = functions.auth
    .user()
    .onCreate(async (event) => {
        const user = event.data
        const { uid, email, displayName } = user
        const [firstName, lastName] = displayName ? displayName.split(' ') : ['', '']
        const userRecord = {
            uid,
            email,
            firstName,
            lastName,
            qualificationRecord: {
                kyc: "Incomplete",
                accreditation: "Incomplete",
            }
        }
        const userDocRef = admin.firestore().collection('users').doc(email)
        await userDocRef.set(userRecord)
        return
})

When it doesn't work I don't even see the outlined_flag | createUser | Function execution started in the functions logs

@valmassoi
Copy link

valmassoi commented Apr 17, 2018

Does
914843b#diff-75da6051ba1f2aa8bbe00ed0340a72c0L86
have to do with it maybe?

Where makeCloudFunction changed to this.onOperation

@rjhuijsman
Copy link
Contributor

The lack of functions getting triggered on a passwordless e-mail login was a server-side issue; we've fixed that now! Thanks again for the reports; let us know if you're still having trouble.

@valmassoi
Copy link

Confirmed it's working again - thanks @rjhuijsman

@radvansky-tomas
Copy link

I am experiencing same issue with anonymous user creation:

"firebase-admin": "~6.0.0",
"firebase-functions": "^2.0.5",

@radvansky-tomas
Copy link

Plus the anonym user has property: isAnonymous: false, which is wrong as well

@radvansky-tomas
Copy link

Issue was on my side - new firebase functions version with correct syntax fixed the issue:
exports.authAction = functions.auth.user().onCreate((userRecord, context) => { const creationTime = userRecord.metadata.creationTime; // 2016-12-15T19:37:37.059Z const lastSignInTime = userRecord.metadata.lastSignInTime; // 2018-01-03T16:23:12.051Z }

joehan added a commit that referenced this issue Apr 18, 2019
* Scheduler

* unit tests

* Adds integration tests for scheduled functions

* removing uninented commit

* fixing version number

* adding labels and test for labels

* trigger tests off of call to cloud scheduler:run

* adding region/runtime opts tests

* Predictions Functions (#220)

* Firebase Predictions Integration with Functions - Initial check in

* Add predictions getter

* Make API match what was in the review, and add unit tests.

* Fix imports.

* Add error handling.

* Handle process.env.GCLOUD_PROJECT correctly.

* Fix region.

* Upper case RiskToleranceName.

* Add changelog message.

* formatting

* cleaning up

* Revert "Predictions Functions (#220)" (#226)

This reverts commit 838597aa6df973462a50484ec1f50d625da3f633.

* pr fixes

* adding clarifying comments

* starting on pubsub impl

* adds pusbub.schedule()

* switching tests over from https to pubsub

* Change timezone to a method instead of an optional argument

* use real eventType

* remove extra slash

* changelog

* switch signature to onRun(context)

* switches changelog to present tense
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants