kreait / firebase-php

Unofficial Firebase Admin SDK for PHP
https://firebase-php.readthedocs.io/
MIT License
2.23k stars 425 forks source link

Not able to send image with FCM #916

Closed Importeer closed 3 days ago

Importeer commented 1 month ago

Describe the bug

I'm using Kreait\Firebase\Messaging\CloudMessage to send push notifications to iOS and Android. These arrive nicely only I can't manage to send them with a photo. There is are no error reports.

Installed packages

"vlucas/phpdotenv": "^5.3",
"ramsey/uuid": "^3.9",
"firebase/php-jwt": "6.10.0",
"slim/slim": "3.*",
"pusher/pusher-php-server": "^7.0",
"setasign/fpdf": "^1.8",
"setasign/fpdi": "^2.0",
"phpmailer/phpmailer": "^6.6",
"google/cloud-vision": "^1.5",
"smalot/pdfparser": "^2.3",
"mollie/mollie-api-php": "^2.0",
"textalk/websocket": "^1.6",
"workerman/phpsocket.io": "^2.0",
"arthurkushman/php-wss": "^2.0",
"kreait/firebase-php": "^7.0"

PHP version and extensions

"vlucas/phpdotenv": "^5.3",
"ramsey/uuid": "^3.9",
"firebase/php-jwt": "6.10.0",
"slim/slim": "3.*",
"pusher/pusher-php-server": "^7.0",
"setasign/fpdf": "^1.8",
"setasign/fpdi": "^2.0",
"phpmailer/phpmailer": "^6.6",
"google/cloud-vision": "^1.5",
"smalot/pdfparser": "^2.3",
"mollie/mollie-api-php": "^2.0",
"textalk/websocket": "^1.6",
"workerman/phpsocket.io": "^2.0",
"arthurkushman/php-wss": "^2.0",
"kreait/firebase-php": "^7.0"

Steps to reproduce the issue.

$deviceTokens = ['...'];

// MESSAGE
$message = CloudMessage::fromArray([
   'notification' => [
      'title' => 'Title',
      'body' => 'Body',
      'image' => 'https://sample-videos.com/img/Sample-jpg-image-50kb.jpg'
   ]
]);

$messaging->sendMulticast($message, $deviceTokens);

Error message/Stack trace

-

Additional information

No response

jeromegamez commented 1 month ago

As long as the Firebase FCM API doesn't return an error, we must assume that the message itself is correct, so I think the image URL is transmitted correctly.

Could you try setting the image in the Android/APNS-specific areas, to see if that works?

It could also be something in the client app that doesn't work right, perhaps you could debug the message there and see if the message contains the image URL.

In general, I can't really provide support on issues like these (except you can find a bug in the SDK code) - the SDK is just sending the messages; once they leave the server, it's up to the Firebase service...

jsomhorstBigspark commented 2 weeks ago

For what it's worth I have to agree with @jeromegamez. We noticed ourselves the same issue but since the results are different depending the devices we test upon we know for sure it is not this package that does it. It seems to be a combination of OS version, application version ( how it interacts with firebase ) etc.

simondaigre commented 1 week ago

I just migrated from official SDK to this library and I have no problems with images. Check if :

jeromegamez commented 1 week ago

Thank you for your comments! ❤️