kreait / laravel-firebase

A Laravel package for the Firebase PHP Admin SDK
https://github.com/kreait/firebase-php
MIT License
994 stars 163 forks source link

Firebase messaging is not working #99

Closed haritartlabs closed 2 years ago

haritartlabs commented 2 years ago

I got below error message while send push notification in my laravel application.

$messaging = app('firebase.messaging'); // here i got below error message

Kreait\Firebase\Exception\InvalidArgumentException Invalid service account: /app/fcm/pulsedin-app-firebase-adminsdk-yvm46-8ffb1e1d3a.json can not be read: SplFileObject::__construct(/app/fcm/pulsedin-app-firebase-adminsdk-yvm46-8ffb1e1d3a.json): Failed to open stream: No such file or directory

Installed packages: "kreait/laravel-firebase": "^3.1", "laravel/framework": "^8.0",

Notes: Before it's working fine but after migrate laravel 7 to 8 then facing this issue.

jeromegamez commented 2 years ago

If this is a file in a subdirectory of your laravel project, try removing the leading slash (/) from the file path. So if you defined FIREBASE_CREDENTIALS=/app/fcm/..., change it to FIREBASE_CREDENTIALS=app/fcm/... 🤞