Closed virenderscideas closed 3 years ago
Hey @virenderscideas, FYI I moved this issue from the firebase-php repo here. How have you configured the package? Which versions of the kreait packages are you using (composer show | grep kreait
)? On which PHP version? Is this something that worked before but stopped working?
i'm facing the same issue
Below is the composer show
what is the right way to configure firebase in laravel? all the tutorials and articles are outdated and there's no recent specific laravel based articles. Thanks in Advance
Have you put a FIREBASE_CREDENTIALS=/path/to/your/service_account.json
line in your .env
file? (https://github.com/kreait/laravel-firebase#configuration)
Its in my project root directory
i've tried this way too
Sorry for the late reply - have you resolved the issue in the meantime? If not, could you please share the full contents of config/firebase.php
?
I'm having the same issue, it's my first time trying firebase and this package. I have placed the service account json in the .env file as well. I haven't touched the firebase.php configuration.
I just realized that FirebaseChannel
seems to be a class from https://github.com/laravel-notification-channels/ - could this perhaps be an error that's triggered from there?
Either way, it would be nice if you could show me some reproducible code that I can use to test this - in my local tests, everything seems to work just fine, and I would be happy if it's a bug in the package, because then I can fix it 🤞
In my case i didn't use FirebaseChannel, I'm still new to firebase so i just followed the documentation of the Firebase PHP Admin SDK
`use Kreait\Firebase\Messaging\CloudMessage; use Kreait\Firebase\Messaging\Notification;
$topic = 'topic';
$title = 'Title';
$body = 'Body';
$messaging = app('firebase.messaging');
$notification = Notification::create($title, $body);
$message = CloudMessage::withTarget('topic', $topic)
->withNotification($notification) // optional
->withData($data) // optional
;
$messaging->send($message);`
Also, I tried not putting the FIREBASE_CREDENTIALS into the .env file to find out what error it'll give me. And it's the same error.
I just tried in my test-laravel project and I'm sorry I can't confirm the problem. What wonders me is that you get the error names myproject
as a project - if no other configuration is present, the default project is referenced as app
. 🤔
Which Laravel and PHP version are you using? What happens when, instead of app('firebase.messaging')
you try
use Kreait\Laravel\Firebase\Facades\Firebase;
// ...
$messaging = Firebase::messaging();
?
Just to be sure, please share the output of these commands in your terminal:
$ php -v
$ composer show
I think I found my mistake. I actually specified the project name in the env file FIREBASE_PROJECT
thinking that this will only let me specify the "Name" of the firebase project. Looking at the firebase.php config file I think I realize how it works now.
Thank you so much @jeromegamez for the very quick response!!
Glad I could help, I hope the package can serve you well from here on! 🌺
I had the same issue but running php artisan config:cache
fixed the issue.
Yes, it's the project ID from credentials file
hii, I am having the same issue, i run the above mentioned commands also, but not worked..
adding FIREBASE_PROJECT in .env still did not work for me
@liza-nt This issue is three years old 😅
Hello,
I am getting this error "Firebase project [myproject] not configured." while sending a notification in laravel with FirebaseChannel. public function via($notifiable) { return [FirebaseChannel::class]; }
it's probably generated from this file but don't know what i did wrong.
vendor/kreait/laravel-firebase/src/FirebaseProjectManager.php:41
protected function configuration(string $name): array { $config = $this->app->config->get('firebase.projects.'.$name) ?? null; if (!$config) { throw new InvalidArgumentException("Firebase project [{$name}] not configured."); } return $config; }