setPersistence in AngularFire _BrowserLocalPersistence cannot be invoked without 'new'`
- Dominant language
- TypeScript
- Stars
- 7.8k
- Forks
- 2.2k
- Avg merge
- 22h 28m
- Merged PRs (30d)
- 6
Description
Problem
The setPersistence method does not work when imported from @angular/fire/auth, leading to a TypeError. However, it works when imported from firebase/auth.
Error
When using the import from @angular/fire/auth, the following error is encountered:
`ERROR TypeError: Class constructor _BrowserLocalPersistence cannot be invoked without 'new'`
Code Example
- Non-functional:
`import { setPersistence, browserLocalPersistence } from '@angular/fire/auth';`
`await setPersistence(this.auth, browserLocalPersistence);`
- Functional:
`import { setPersistence, browserLocalPersistence } from 'firebase/auth';`
`await setPersistence(this.auth, browserLocalPersistence);`
Contributor guide
Research direction
Reproduce the failure using the @angular/fire/auth imports and compare it with the working firebase/auth imports shown in the issue. Trace the authentication entry points and verify that setPersistence with browserLocalPersistence works through @angular/fire/auth without the TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, firebase, typescript
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 43/100