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

[firebase-messaging] Cannot read property 'AUTHORIZED' of undefined #17

Closed
eikaramba opened this issue Nov 14, 2021 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@eikaramba
Copy link

eikaramba commented Nov 14, 2021

a little bit strange but i am using this code

const authStatus = await messaging.requestPermission({
    			ios: {
    				alert: true,
    			},
    		});

            const enabled = authStatus === messaging.AuthorizationStatus.AUTHORIZED || authStatus === messaging.AuthorizationStatus.PROVISIONAL;

and get the error (on Android)
Cannot read property 'AUTHORIZED' of undefined

authStatus is 0 here. you can reproduce this in my repo here: https://github.com/eikaramba/firebase-test

@triniwiz triniwiz added the bug Something isn't working label Nov 14, 2021
@eikaramba
Copy link
Author

i'm using 1.0.0-alpha.21 now and still get this error. messaging.AuthorizationStatus is undefined. i double checked node_modules, it is really using that version. i tried everything, but somehow it is always undefined.

@triniwiz
Copy link
Member

Try importing AuthorizationStatus from the messaging package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants