Closed Zein0 closed 1 year ago
The issue is with ur
**FIREBASE_CREDENTIALS**="JustTheFirebaseSDKpath.json"
FIREBASE_DATABASE_URL="https://testgithub-gye656.firebaseio.com/"
You're using the file content(JSON format) in a variable(it should work in other scenarios but not with .env variables), please use the path to the file. Store it on you're WORKSPACEPATH then set the variables like this =>
FIREBASE_CREDENTIALS=XNAME-firebase-adminsdk-.json
FIREBASE_DATABASE_URL=https://DBURL.firebaseio.com
Remember to move the Credentials file to a secure path on production ;), this should fix the issue if it doesn't try generating a new JSON Credential file, also don't use " on the firebase configuration vars
I was using app('firebase.messaging');
but under the hood it tries to utilize env()
directly. so just you should do this way
public function connect(): Messaging
{
$firebase = (new Factory)->withServiceAccount(base_path(config('services.firebase.credentials')));
return $firebase->createMessaging();
}
as mentioned by @Techscq !
I'm trying to send a message yet I've had multiple errors regarding what I assume is Firebase credentials the recent error suggest
Invalid service account: Cannot use SplFileObject with directories", my .env
FirebaseService