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

verifyPhoneNumber don't work this._auth.emitter.once is not a function #4696

Closed
iddar opened this issue Dec 21, 2020 · 7 comments
Closed

verifyPhoneNumber don't work this._auth.emitter.once is not a function #4696

iddar opened this issue Dec 21, 2020 · 7 comments
Assignees
Labels
Help: Needs Triage Issue needs additional investigation/triaging. Impact: Bug New bug report Service: Authentication Firebase Authentication Workflow: Needs Review Pending feedback or review from a maintainer.

Comments

@iddar
Copy link

iddar commented Dec 21, 2020

I try run auth().verifyPhoneNumber(phoneNumber) like documentation examples (use on and then syntax) and show this message in a console. Same result in rnFirabse 10.3.0 and 10.2.0.

All other Auth methods work fine in js engine and Hermes

TypeError: this._auth.emitter.once is not a function.
(In 'this._auth.emitter.once(this._internalEvents[type], this["_" + type + "Handler"].bind(this))',
'this._auth.emitter.once' is undefined)

my code

async function signInWithPhoneNumber(phoneNumber) {
    const confirmationw = auth()
      .verifyPhoneNumber(phoneNumber)
      .on('state_changed', (phoneAuthSnapshot) => {
        console.log(phoneAuthSnapshot)
      })
    console.log(confirmationw)
}

Env

iOS 14
Mac OS Big Sur
React-Native 0.64.0-rc.1
React 17.0.1
react-native-firebase/app 10.3.0
react-native-firebase/auth 10.3.1
react-native-firebase/firestore 10.3.1
@mikehardy
Copy link
Collaborator

I don't think this will be your problem but careful with the versions, they are locked together now so should be all 10.3.1

Have you attempted to track down in node_modules/@react-native-firebase/auth what is being called exactly?

@iddar
Copy link
Author

iddar commented Dec 21, 2020

Have you attempted to track down in node_modules/@react-native-firebase/auth what is being called exactly?

I have tried,
I have only been able to see the definition of the interface and more,
it may be an error with the EventEmitter

Before update to 10.3.0 try on 10.2.0 and don't work

Thanks for your recommendation, now all updated to the last version.

@mikehardy
Copy link
Collaborator

mikehardy commented Dec 21, 2020

Strange! I use this in my app and while I don't have automated testing around it I know I had it working at some point. I'll investigate.

(note I transferred this issue to the main repository, it's not a docs issue I don't think)

@mikehardy mikehardy self-assigned this Dec 21, 2020
@mikehardy mikehardy transferred this issue from invertase/react-native-firebase-docs Dec 21, 2020
@mikehardy mikehardy added Help: Needs Triage Issue needs additional investigation/triaging. Impact: Bug New bug report Service: Authentication Firebase Authentication Workflow: Needs Review Pending feedback or review from a maintainer. labels Dec 21, 2020
@shaurya2612
Copy link

I am facing the same problem on my android physical device.

Any updates?

@mikehardy
Copy link
Collaborator

Ah! This was solved. It was a forward port needed for react-native 0.64. I did that and released it: #5042 - you need v11.1.2 or higher of react-native firebase

@SornchaiTheDev
Copy link

I updated react-native to 0.64 and react-native-firebase to v11.2.0 but I has the same problem did I do it correct way ?
It return
Possible Unhandled Promise Rejection (id: 0):
TypeError: undefined is not a function
TypeError: undefined is not a function

Code :
const getOTP = async () => {
const confirmation = await auth()
.verifyPhoneNumber("phone num here")
.then((confirm) => console.log(confirm))
.catch((err) => console.log(err.code));
}

@mikehardy
Copy link
Collaborator

If you have v11.2.0 then things should work, my guess is there is some level of caching happening meaning that you have the updated dependency version but that's not the actual code running. npx react-native-clean-project is my typical prescription for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help: Needs Triage Issue needs additional investigation/triaging. Impact: Bug New bug report Service: Authentication Firebase Authentication Workflow: Needs Review Pending feedback or review from a maintainer.
Projects
None yet
Development

No branches or pull requests

4 participants