kreait / firebase-bundle

A Symfony Bundle for the Firebase PHP Admin SDK
https://github.com/kreait/firebase-php
MIT License
135 stars 25 forks source link

Failed to load class Google\Cloud\Firestore\FirestoreClient used by typed property Kreait\Firebase\Firestore::$client during preloading #35

Closed badr-ou closed 3 years ago

badr-ou commented 3 years ago

Describe the issue you are experiencing

Hi there,

I'm getting this error, when i apply composer dump-autoload -o --no-dev or composer dump-autoload --classmap-authoritative --no-dev during the build of my container and i run it but when i apply composer dump-autoload -o it works perfectly.

I only use cloud messaging service.

Thanks.

Installed packages

Error message/Stack trace

NOTICE: PHP message: PHP Fatal error: Failed to load class Google\Cloud\Firestore\FirestoreClient used by typed property Kreait\Firebase\Firestore::$client during preloading in Unknown on line 0

badr-ou commented 3 years ago

It's solved, it was a symfony environment problem.

dsech commented 2 years ago

@badr-ou I'm experiencing the same issue, how did you solve it?

blt909 commented 2 years ago

@dsech we were targeting an non-created environment in symfony, basically using --env=staging while having no folder and not any env definition files in it

dsech commented 2 years ago

@blt909 Thanks, I think I'm encountering a different issue then, because the env is built and warmed up in my case, and the error appears only when using opcache.preload=/app/config/preload.php in php-fpm. My current workaround is to not use preloading at all, which isn't ideal.

I will debug some more to find what is my issue.

dsech commented 2 years ago

I found a workaround by configuring public: false inside firebase.yaml. This way Symfony did not include anymore the unused Kreait\Firebase\Firestore class in the preload script.

I suppose it would be nice to avoid this issue, by having public: false by default, or have an option to enable each service separately?