laravel-notification-channels / fcm

Firebase Cloud Messaging (FCM) notifications channel for Laravel
https://laravel-notification-channels.com/
MIT License
472 stars 121 forks source link

Unable to determine the Firebase Project ID #188

Closed jaimincygnet closed 5 months ago

jaimincygnet commented 5 months ago

Now we are upgrading version

"laravel-notification-channels/fcm": "4.1.0", "laravel/framework": "^10.10",

Still facing same error.

Unable to determine the Firebase Project ID

`$fcmNotification = FcmNotification::create() ->setTitle($this->notification->title) ->setBody($this->notification->message);

    $sendData = [
        'action'          => 'deep-link',
        'key'             => $this->key,
        'notification_id' => $this->notification->getKey(),
    ];

    if (!empty($this->notification->deep_link_uri)) {
        $sendData['redirect_url'] = $this->notification->deep_link_uri;
    }

    // The FcmMessage contains other options for the notification
    return FcmMessage::create()
        ->setPriority(FcmMessage::PRIORITY_HIGH)
        ->setTimeToLive(86400)
        ->setNotification($fcmNotification)
        ->setData((object) $sendData);`
dwightwatson commented 5 months ago

Have you set the FIREBASE_CREDENTIALS environment variable that includes project_id?

pinakam commented 2 months ago

I got the same error. Can you please help me out @dwightwatson.

I've try with 2 different key set in .env like

FCM_SERVER_KEY="my server key"

and

FCM_CREDENTIALS=file://storage/app/firebase/service-account.json