Closed friedrich-henrique closed 1 year ago
Unfortunately I can't reproduce the issue without knowing how you are using the package. Do you inject the API client directly into a service/controller (if yes, you shouldn't 😅). Have you published and changed the Firebase config? If so, what does the config look like? Did you have the same version of the Firebase Laravel Package before the upgrade from Laravel 8 to 9? Why are you using the dev-branch of this package instead of the latest release?
Please help me help you by giving me enough information to reproduce the issue.
You can test if the issue lies in this package or the SDK by performing the following steps:
$ composer create-project laravel/laravel laravel9-with-firebase
$ cd laravel9-with-firebase
$ composer require -W kreait/laravel-firebase
$ php artisan vendor:publish --provider="Kreait\Laravel\Firebase\ServiceProvider" --tag=config
$ composer update -W
If this works (and it should), some other dependency in your project likely interferes. The multiple Deprecation warnings are an additional sign that something has not been updated. One reason could be that your composer
binary is not on the latest version. A composer self-update
should bring you to version 2.4.2.
Let me know how it goes!
Thanks for the polite and complete reply. I will perform those actions and post here back again later.
Doing your steps really work indeed.
I was trying to upgrade Laravel from 8 to 9 and did not change the Firebase Laravel Package initially, but this error happened and then I ended up changing it too, the dev branch was a despairing act.
I did not publish the configs and I use the Firebase credentials as recommended on the documentation.
Does perhaps a composer update -W
in your project work, in case you haven't already tried that? The deprecation warnings "worry" me, I usually try to address everything else when I tackle such problems, even if it doesn't look directly related. Sometimes this fixes other problems at the same time, but at least everything else is out of the way and it helps focusing on the actual problem better.
You could also try to call the package's ProjectManager directly from within artisan tinker
or create a simple controller starting with the simplest use cas and then continue to build it up until it breaks.
Just to be sure: if you inject components of the SDK into your services/controllers, you need to use the contracts, not the implementations.
Everything is working seamlessly with Laravel 8, but when trying to upgrade to 9 this error happens.
The good news is given your last message I checked the injection throughout the project, and there were some injections of the implementations instead of the contracts.
Thanks for all the support.
Hi @oqfs06 , have you worked it out? I have encountered the same issue when upgrading Laravel from 8 to 9.
I got this problem in my sending job:
use Kreait\Firebase\Messaging;
public function handle(Messaging $firebase)
{
$response = $firebase->sendMulticast($this->message, $this->pushProfile->Token);
}
to fix that I just change the dependency:
use Kreait\Laravel\Firebase\Facades\Firebase;
public function handle()
{
$response = Firebase::messaging()->sendMulticast($this->message, $this->pushProfile->Token);
}
@wislert It should work by using
use Kreait\Firebase\Contract\Messaging;
instead of
use Kreait\Firebase\Messaging;
Describe the issue you are experiencing
After trying to update from Laravel 8 to 9, I had encountered a bug related to this package.
Installed packages
PHP version and extensions
On which operating system(s) does the issue occur?
Steps to reproduce the issue.
Error message/Stack trace
Additional information
No response