angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

Error uploading image: Error: Either AngularFireModule has not been provided in your AppModule ( project v17 standalone)

Open thanhnguyen568 opened this issue 1 year ago • 3 comments

Version info

**Angular: 17.3.0 **

Firebase: 10.12.2

AngularFire: 17.1.0

Debug output

** Errors in the JavaScript console: Error uploading image: Error: Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using provideFirebaseApp) or you're calling an AngularFire method outside of an NgModule (which is not supported). at getSchedulers (angular-fire.mjs:142:11) at runOutsideAngular (angular-fire.mjs:148:10) at angular-fire.mjs:216:17 at _UploadService. (upload.service.ts:15:23) at Generator.next () at main.js:18:61 at new ZoneAwarePromise (zone.js:2611:25) at __async (main.js:2:10) at _UploadService.uploadFile (upload.service.ts:12:30) at _DialogExaminationFormUpdateComponent. (dialog-examination-form-update.component.ts:125:54) **

** Screenshots image **

thanhnguyen568 avatar Jun 22 '24 09:06 thanhnguyen568

This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Jun 22 '24 09:06 google-oss-bot

It could be that you are using getAuth(), getStorage(), or getFireStore() within a service or component.

I encountered a similar issue when I was using getAuth() directly in my service like this:

const auth = getAuth();
const uc = await signInWithEmailAndPassword(auth, email, password);

After modifying my approach to the following, my code started working correctly:

constructor(private _auth: AngularFireAuth) {}

...

const uc = await this._auth.signInWithEmailAndPassword(email, password);

I hope this helps!

BurscherChris avatar Jun 22 '24 17:06 BurscherChris

Just in case, try to remove node_modules and yarn.lock or package-lock.json and do a fresh install as sometimes there are multiple firebase versions being called without noticing.

KingDarBoja avatar Jun 25 '24 18:06 KingDarBoja