Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase project [myproject] not configured. #70

Closed
virenderscideas opened this issue Dec 4, 2020 · 18 comments
Closed

Firebase project [myproject] not configured. #70

virenderscideas opened this issue Dec 4, 2020 · 18 comments

Comments

@virenderscideas
Copy link

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;
}

@jeromegamez jeromegamez transferred this issue from kreait/firebase-php Dec 4, 2020
@jeromegamez
Copy link
Member

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?

@adityaa-codes
Copy link

i'm facing the same issue
Below is the composer show
image

@adityaa-codes
Copy link

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

@jeromegamez
Copy link
Member

jeromegamez commented Dec 8, 2020

Have you put a FIREBASE_CREDENTIALS=/path/to/your/service_account.json line in your .env file? (https://github.com/kreait/laravel-firebase#configuration)

@adityaa-codes
Copy link

adityaa-codes commented Dec 8, 2020

Its in my project root directory image

i've tried this way too
image

@jeromegamez
Copy link
Member

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?

@denzkiuy
Copy link

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.

@jeromegamez
Copy link
Member

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 🤞

@denzkiuy
Copy link

denzkiuy commented Jan 13, 2021

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);`

@denzkiuy
Copy link

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.

@jeromegamez
Copy link
Member

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

@denzkiuy
Copy link

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!!

@jeromegamez
Copy link
Member

Glad I could help, I hope the package can serve you well from here on! 🌺

@Prakort
Copy link

Prakort commented May 11, 2022

I had the same issue but running php artisan config:cache fixed the issue.

@jeromegamez
Copy link
Member

Yes, it's the project ID from credentials file

@nehabvm23
Copy link

hii, I am having the same issue, i run the above mentioned commands also, but not worked..

@liza-nt
Copy link

liza-nt commented Jan 24, 2024

adding FIREBASE_PROJECT in .env still did not work for me

@jeromegamez
Copy link
Member

@liza-nt This issue is three years old 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants