laravel-notification-channels / fcm

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

Call to undefined function GuzzleHttp Psr7 uri_for() #112

Closed ElviKr2 closed 2 years ago

ElviKr2 commented 2 years ago

Hello, I'm giving maintenance to a project but I get this error when I try to send fcm notifications: Call to undefined function GuzzleHttp\Psr7\uri_for() on vendor\kreait\firebase-php\src\Firebase\Messaging\Http\Request\SendMessage.php line 20

The package is required as "laravel-notification-channels/fcm": "~2.0", and the installed version is 2.2.1, for guzzle I have: guzzlehttp/guzzle 7.4.0 guzzlehttp/promises 1.5.1 guzzlehttp/psr7 2.1.0

The current PHP version is 7.4.6 i'm working with laravel 8. Could someone help me?

oommgg commented 2 years ago

Hello, I'm giving maintenance to a project but I get this error when I try to send fcm notifications: Call to undefined function GuzzleHttp\Psr7\uri_for() on vendor\kreait\firebase-php\src\Firebase\Messaging\Http\Request\SendMessage.php line 20

The package is required as "laravel-notification-channels/fcm": "~2.0", and the installed version is 2.2.1, for guzzle I have: guzzlehttp/guzzle 7.4.0 guzzlehttp/promises 1.5.1 guzzlehttp/psr7 2.1.0

The current PHP version is 7.4.6 i'm working with laravel 8. Could someone help me?

Are you using tymon/jwt-auth?

i got same problem, and i did following step

composer remove tymon/jwt-auth
composer require tymon/jwt-auth:dev-develop
composer require laravel-notification-channels/fcm

then, it's working for my project

DebugTheCode commented 2 years ago

I'm also experiencing this problem. The package uses guzzle 7.0, but that problem seems to be resolved from guzzle 7.3.

I also suggest updating firebase to https://github.com/kreait/firebase-php/releases/tag/6.3.1

DebugTheCode commented 2 years ago

So actually, I resolved the problem I had and @oommgg was in the right direction.

I also was using tymon/jwt-auth, which uses lcobucci/jwt which was conflicting with the latest kreait/laravel-firebase. So what I did was removing jwt-auth, composer install, composer require kreait/laravel-firebase, composer require laravel-notification-channels/fcm, composer require tymon/jwt-auth and then composer install after removing composer.lock en vendor folder first.