kreait / firebase-php

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

ERROR: A message can only have one of the following targets: condition, token, topic, unknown #712

Closed danvaly closed 2 years ago

danvaly commented 2 years ago

Describe the issue you are experiencing

Hi, I try to send a message trough the latest version of firebase-php.

Problem is that the error from title is raised on the following file :

src/Firebase/Messaging/CloudMessage.php on line 73

if (\count(\array_intersect(\array_keys($data), MessageTarget::TYPES)) > 1) {
            throw new InvalidArgument(
                'A message can only have one of the following targets: '
                .\implode(', ', MessageTarget::TYPES)
            );
        }

The error is because is checking to have only one type but always it receive all of them with null values. Can you check it please?

Installed packages

asm89/stack-cors                               v2.1.1             Cross-origin resource sharing library and stack middleware
barryvdh/laravel-ide-helper                    v2.12.3            Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.
barryvdh/reflection-docblock                   v2.0.6
beberlei/assert                                v3.3.2             Thin assertion library for input validation in business models.
beste/clock                                    2.1.0              A collection of Clock implementations
beste/json                                     1.0.0              A simple JSON helper to decode and encode JSON
beyondcode/laravel-websockets                  1.13.1             An easy to use WebSocket server
brick/math                                     0.9.3              Arbitrary-precision arithmetic library
cboden/ratchet                                 v0.4.4             PHP WebSocket library
clue/stream-filter                             v1.6.0             A simple and modern approach to stream filtering in PHP
codedge/laravel-fpdf                           1.8.1              Laravel package to include Fpdf. It ships with Fpdf 1.84.
composer/pcre                                  3.0.0              PCRE wrapping library that offers type-safe preg_* replacements.
composer/semver                                3.3.2              Semver library that offers utilities, version constraint parsing and validation.
composer/xdebug-handler                        3.0.3              Restarts a process without Xdebug.
danvaly/pdfdesigner                            v3.x-dev 72a002d   Generator de documente PDF bazat pe blocuri predefinite
dealerdirect/phpcodesniffer-composer-installer v0.7.2             PHP_CodeSniffer Standards Composer Installer Plugin
dflydev/dot-access-data                        v3.0.1             Given a deep data structure, access data by dot notation.
doctrine/annotations                           1.13.3             Docblock Annotations Parser
doctrine/cache                                 2.2.0              PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.
doctrine/dbal                                  3.3.7              Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.
doctrine/deprecations                          v1.0.0             A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.
doctrine/event-manager                         1.1.1              The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.
doctrine/inflector                             2.0.4              PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.
doctrine/instantiator                          1.4.1              A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                                 1.2.3              PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
dompdf/dompdf                                  v1.2.2             DOMPDF is a CSS 2.1 compliant HTML to PDF converter
dragonmantank/cron-expression                  v3.3.1             CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
egulias/email-validator                        3.2.1              A library for validating emails against several RFCs
evenement/evenement                            v3.0.1             Événement is a very simple event dispatching library for PHP
ezyang/htmlpurifier                            v4.14.0            Standards compliant HTML filter written in PHP
facade/ignition-contracts                      1.0.2              Solution contracts for Ignition
fig/http-message-util                          1.1.5              Utility classes and constants for use with PSR-7 (psr/http-message)
filp/whoops                                    2.14.5             php error handling for cool kids
firebase/php-jwt                               v6.2.0             A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.
friendsofphp/php-cs-fixer                      v3.8.0             A tool to automatically fix PHP code style
fruitcake/laravel-cors                         v2.2.0             Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel application
fruitcake/php-cors                             v1.2.0             Cross-origin resource sharing library for the Symfony HttpFoundation
fzaninotto/faker                               dev-master 5ffe7db Faker is a PHP library that generates fake data for you.
google/auth                                    v1.21.1            Google Auth Library for PHP
google/cloud-core                              v1.46.1            Google Cloud PHP shared dependency, providing functionality useful to all components.
google/cloud-storage                           v1.27.1            Cloud Storage Client for PHP
google/crc32                                   v0.1.0             Various CRC32 implementations
graham-campbell/result-type                    v1.0.4             An Implementation Of The Result Type
guzzlehttp/guzzle                              7.4.5              Guzzle is a PHP HTTP client library
guzzlehttp/promises                            1.5.1              Guzzle promises library
guzzlehttp/psr7                                2.4.0              PSR-7 message implementation that also provides common utility methods
hamcrest/hamcrest-php                          v2.0.1             This is the PHP port of Hamcrest Matchers
inspector-apm/inspector-laravel                4.7.24             Simple Code Execution Monitoring for Laravel applications.
inspector-apm/inspector-php                    3.7.14             Inspector for PHP applications.
intervention/image                             2.7.2              Image handling and manipulation library with support for Laravel integration
justinrainbow/json-schema                      5.2.12             A library to validate a json schema.
kreait/firebase-php                            6.5.1              Firebase Admin SDK
kreait/firebase-tokens                         3.0.2              A library to work with Firebase tokens
kreait/laravel-firebase                        4.1.0              A Laravel package for the Firebase PHP Admin SDK
laminas/laminas-escaper                        2.10.0             Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs
laravel-notification-channels/fcm              2.4.0              FCM (Firebase Cloud Messaging) Notifications Driver for Laravel
laravel/breeze                                 v1.10.0            Minimal Laravel authentication scaffolding with Blade and Tailwind.
laravel/framework                              v9.19.0            The Laravel Framework.
laravel/sanctum                                v2.15.1            Laravel Sanctum provides a featherweight authentication system for SPAs and simple APIs.
laravel/serializable-closure                   v1.2.0             Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP.
laravel/tinker                                 v2.7.2             Powerful REPL for the Laravel framework.
lcobucci/clock                                 2.2.0              Yet another clock abstraction
lcobucci/jwt                                   4.1.5              A simple library to work with JSON Web Token and JSON Web Signature
league/commonmark                              2.3.3              Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)
league/config                                  v1.1.1             Define configuration arrays with strict schemas and access values with dot notation
league/container                               4.2.0              A fast and intuitive dependency injection container.
league/flysystem                               3.1.0              File storage abstraction for PHP
league/mime-type-detection                     1.11.0             Mime-type detection for Flysystem
maennchen/zipstream-php                        2.2.1              ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.
mailersend/laravel-driver                      v2.0.0             MailerSend Laravel Driver
mailersend/mailersend                          v0.5.0             MailerSend PHP SDK
markbaker/complex                              3.0.1              PHP Class for working with complex numbers
markbaker/matrix                               3.0.0              PHP Class for working with matrices
mockery/mockery                                1.5.0              Mockery is a simple yet flexible PHP mock object framework
monolog/monolog                                2.7.0              Sends your logs to files, sockets, inboxes, databases and various web services
mtdowling/jmespath.php                         2.6.1              Declaratively specify how to extract elements from a JSON document
myclabs/deep-copy                              1.11.0             Create deep copies (clones) of your objects
myclabs/php-enum                               1.8.3              PHP Enum implementation
ncjoes/office-converter                        v1.0.3             PHP Wrapper for LibreOffice
nesbot/carbon                                  2.59.1             An API extension for DateTime that supports 281 different languages.
nette/schema                                   v1.2.2             � Nette Schema: validating data structures against a given Schema.
nette/utils                                    v3.2.7             �  Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON e ncoding/decoding, validation, slug or strong password generating etc.
nikic/php-parser                               v4.14.0            A PHP parser written in PHP
nunomaduro/collision                           v6.2.1             Cli error handling for console/command-line PHP applications.
nunomaduro/phpinsights                         v2.4.0             Instant PHP quality checks from your console.
nwidart/laravel-modules                        8.2.0              Laravel Module management
nyholm/psr7                                    1.5.1              A fast PHP7 implementation of PSR-7
paragonie/random_compat                        v9.99.100          PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
paragonie/sodium_compat                        v1.17.1            Pure PHP implementation of libsodium; uses the PHP extension if it exists
phar-io/manifest                               2.0.3              Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                                3.2.1              Library for handling version information and constraints
phenx/php-font-lib                             0.5.4              A library to read, parse, export and make subsets of different types of font files.
phenx/php-svg-lib                              0.4.1              A library to read, parse and export to PDF SVG files.
php-cs-fixer/diff                              v2.0.2             sebastian/diff v3 backport support for PHP 5.6+
php-http/client-common                         2.5.0              Common HTTP Client implementations and tools for HTTPlug
php-http/discovery                             1.14.2             Finds installed HTTPlug implementations and PSR-7 message factories
php-http/guzzle7-adapter                       1.0.0              Guzzle 7 HTTP Adapter
php-http/httplug                               2.3.0              HTTPlug, the HTTP client abstraction for PHP
php-http/message                               1.13.0             HTTP Message related tools
php-http/message-factory                       v1.0.2             Factory interfaces for PSR-7 HTTP Message
php-http/promise                               1.1.0              Promise used for asynchronous HTTP requests
php-parallel-lint/php-parallel-lint            v1.3.2             This tool check syntax of PHP files about 20x faster than serial check.
phpdocumentor/reflection-common                2.2.0              Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock              5.3.0              With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.
phpdocumentor/type-resolver                    1.6.1              A PSR-5 based resolver of Class names, Types and Structural Element Names
phploc/phploc                                  7.0.2              A tool for quickly measuring the size of a PHP project.
phpoffice/phpspreadsheet                       1.23.0             PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine
phpoffice/phpword                              0.18.3             PHPWord - A pure PHP library for reading and writing word processing documents (OOXML, ODF, RTF, HTML, PDF)
phpoption/phpoption                            1.8.1              Option Type for PHP
phpspec/prophecy                               v1.15.0            Highly opinionated mocking framework for PHP 5.3+
phpstan/phpdoc-parser                          1.6.4              PHPDoc parser with support for nullable, intersection and generic types
phpunit/php-code-coverage                      9.2.15             Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator                      3.0.6              FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker                            3.1.1              Invoke callables with a timeout
phpunit/php-text-template                      2.0.4              Simple template engine.
phpunit/php-timer                              5.0.3              Utility class for timing
phpunit/phpunit                                9.5.21             The PHP Unit Testing framework.
predis/predis                                  v1.1.10            Flexible and feature-complete Redis client for PHP and HHVM
psr/cache                                      3.0.0              Common interface for caching libraries
psr/container                                  2.0.2              Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher                           1.0.0              Standard interfaces for event handling.
psr/http-client                                1.0.1              Common interface for HTTP clients
psr/http-factory                               1.0.1              Common interfaces for PSR-7 HTTP message factories
psr/http-message                               1.0.1              Common interface for HTTP messages
psr/log                                        1.1.4              Common interface for logging libraries
psr/simple-cache                               2.0.0              Common interfaces for simple caching
psy/psysh                                      v0.11.6            An interactive shell for modern PHP.
pusher/pusher-php-server                       5.0.3              Library for interacting with the Pusher REST API
ralouphie/getallheaders                        3.0.3              A polyfill for getallheaders.
ramsey/collection                              1.2.2              A PHP library for representing and manipulating collections.
ramsey/uuid                                    4.3.1              A PHP library for generating and working with universally unique identifiers (UUIDs).
ratchet/rfc6455                                v0.3.1             RFC6455 WebSocket protocol handler
react/cache                                    v1.1.1             Async, Promise-based cache interface for ReactPHP
react/dns                                      v1.9.0             Async DNS resolver for ReactPHP
react/event-loop                               v1.3.0             ReactPHP's core reactor event loop that libraries can use for evented I/O.
react/http                                     v1.6.0             Event-driven, streaming HTTP client and server implementation for ReactPHP
react/promise                                  v2.9.0             A lightweight implementation of CommonJS Promises/A for PHP
react/promise-stream                           v1.4.0             The missing link between Promise-land and Stream-land for ReactPHP
react/promise-timer                            v1.9.0             A trivial implementation of timeouts for Promises, built on top of ReactPHP.
react/socket                                   v1.11.0            Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP
react/stream                                   v1.2.0             Event-driven readable and writable streams for non-blocking I/O in ReactPHP
rennokki/laravel-eloquent-query-cache          3.3.0              Adding cache on your Laravel Eloquent queries' results is now a breeze.
ringcentral/psr7                               1.3.0              PSR-7 message implementation
riverline/multipart-parser                     2.0.9              One class library to parse multipart content with encoding and charset support.
rize/uri-template                              0.3.4              PHP URI Template (RFC 6570) supports both expansion & extraction
sabberworm/php-css-parser                      8.4.0              Parser for CSS Files written in PHP
sebastian/cli-parser                           1.0.1              Library for parsing CLI options
sebastian/code-unit                            1.0.8              Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup             2.0.3              Looks up which function or method a line of code belongs to
sebastian/comparator                           4.0.6              Provides the functionality to compare PHP values for equality
sebastian/complexity                           2.0.2              Library for calculating the complexity of PHP code units
sebastian/diff                                 4.0.4              Diff implementation
sebastian/environment                          5.1.4              Provides functionality to handle HHVM/PHP environments
sebastian/exporter                             4.0.4              Provides the functionality to export PHP variables for visualization
sebastian/global-state                         5.0.5              Snapshotting of global state
sebastian/lines-of-code                        1.0.3              Library for counting the lines of code in PHP source code
sebastian/object-enumerator                    4.0.4              Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector                     2.0.4              Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context                    4.0.4              Provides functionality to recursively process PHP variables
sebastian/resource-operations                  3.0.3              Provides a list of PHP built-in functions that operate on resources
sebastian/type                                 3.0.0              Collection of value objects that represent the types of the PHP type system
sebastian/version                              3.0.2              Library that helps with managing the version number of Git-hosted PHP projects
slevomat/coding-standard                       7.2.1              Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.
spatie/backtrace                               1.2.1              A better backtrace
spatie/enum                                    3.13.0             PHP Enums
spatie/flare-client-php                        1.2.0              Send PHP errors to Flare
spatie/ignition                                1.3.1              A beautiful error page for PHP applications.
spatie/laravel-ignition                        1.3.1              A beautiful error page for Laravel applications.
spatie/laravel-package-tools                   1.12.1             Tools for creating Laravel packages
spatie/laravel-translatable                    6.0.0              A trait to make an Eloquent model hold translations
squizlabs/php_codesniffer                      3.7.1              PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.
stancl/jobpipeline                             v1.6.1             Turn any series of jobs into Laravel listeners.
stancl/tenancy                                 v3.5.7             Automatic multi-tenancy for your Laravel application.
stancl/virtualcolumn                           v1.2.1             Eloquent virtual column.
stella-maris/clock                             0.1.4              A pre-release of the proposed PSR-20 Clock-Interface
symfony/cache                                  v6.1.2             Provides an extended PSR-6, PSR-16 (and tags) implementation
symfony/cache-contracts                        v3.1.1             Generic abstractions related to caching
symfony/console                                v6.1.2             Eases the creation of beautiful and testable command line interfaces
symfony/css-selector                           v6.1.0             Converts CSS selectors to XPath expressions
symfony/deprecation-contracts                  v3.1.1             A generic function and convention to trigger deprecation notices
symfony/error-handler                          v6.1.0             Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher                       v6.1.0             Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
symfony/event-dispatcher-contracts             v3.1.1             Generic abstractions related to dispatching event
symfony/filesystem                             v6.1.0             Provides basic utilities for the filesystem
symfony/finder                                 v6.1.0             Finds files and directories via an intuitive fluent interface
symfony/http-client                            v6.1.2             Provides powerful methods to fetch HTTP resources synchronously or asynchronously
symfony/http-client-contracts                  v3.1.1             Generic abstractions related to HTTP clients
symfony/http-foundation                        v6.1.2             Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                            v6.1.2             Provides a structured process for converting a Request into a Response
symfony/mailer                                 v6.1.2             Helps sending emails
symfony/mime                                   v6.1.1             Allows manipulating MIME messages
symfony/options-resolver                       v6.1.0             Provides an improved replacement for the array_replace PHP function
symfony/polyfill-ctype                         v1.26.0            Symfony polyfill for ctype functions
symfony/polyfill-intl-grapheme                 v1.26.0            Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-idn                      v1.26.0            Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer               v1.26.0            Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring                      v1.26.0            Symfony polyfill for the Mbstring extension
symfony/polyfill-php72                         v1.26.0            Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php80                         v1.26.0            Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/polyfill-php81                         v1.26.0            Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions
symfony/process                                v6.1.0             Executes commands in sub-processes
symfony/psr-http-message-bridge                v2.1.2             PSR HTTP message bridge
symfony/routing                                v6.1.1             Maps an HTTP request to a set of configuration variables
symfony/service-contracts                      v3.1.1             Generic abstractions related to writing services
symfony/stopwatch                              v6.1.0             Provides a way to profile code
symfony/string                                 v6.1.2             Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way
symfony/translation                            v6.1.0             Provides tools to internationalize your application
symfony/translation-contracts                  v3.1.1             Generic abstractions related to translation
symfony/var-dumper                             v6.1.0             Provides mechanisms for walking through any arbitrary PHP variable
symfony/var-exporter                           v6.1.1             Allows exporting any serializable PHP data structure to plain PHP code
theseer/tokenizer                              1.2.1              A small library for converting tokenized PHP source code into XML and potentially other formats
tightenco/collect                              v8.83.15           Collect - Illuminate Collections as a separate package.
tijsverkoyen/css-to-inline-styles              2.2.4              CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.
tucker-eric/eloquentfilter                     3.1.0              An Eloquent way to filter Eloquent Models
vlucas/phpdotenv                               v5.4.1             Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.
voku/portable-ascii                            2.0.1              Portable ASCII library - performance optimized (ascii) string functions for php.
webmozart/assert                               1.11.0             Assertions to validate method input/output with nice error messages.

PHP version and extensions

composer               2.3.5    Composer package
composer-plugin-api    2.3.0    The Composer Plugin API
composer-runtime-api   2.2.2    The Composer Runtime API
ext-bcmath             8.1.1    The bcmath PHP extension
ext-bz2                8.1.1    The bz2 PHP extension
ext-calendar           8.1.1    The calendar PHP extension
ext-ctype              8.1.1    The ctype PHP extension
ext-curl               8.1.1    The curl PHP extension
ext-date               8.1.1    The date PHP extension
ext-dom                20031129 The dom PHP extension
ext-enchant            8.1.1    The enchant PHP extension
ext-exif               8.1.1    The exif PHP extension
ext-fileinfo           8.1.1    The fileinfo PHP extension
ext-filter             8.1.1    The filter PHP extension
ext-ftp                8.1.1    The ftp PHP extension
ext-gd                 8.1.1    The gd PHP extension
ext-gettext            8.1.1    The gettext PHP extension
ext-hash               8.1.1    The hash PHP extension
ext-iconv              8.1.1    The iconv PHP extension
ext-json               8.1.1    The json PHP extension
ext-libxml             8.1.1    The libxml PHP extension
ext-mbstring           8.1.1    The mbstring PHP extension
ext-mysqli             8.1.1    The mysqli PHP extension
ext-mysqlnd            0        The mysqlnd PHP extension (actual version: mysqlnd 8.1.1)
ext-odbc               8.1.1    The odbc PHP extension
ext-openssl            8.1.1    The openssl PHP extension
ext-pcre               8.1.1    The pcre PHP extension
ext-pdo                8.1.1    The PDO PHP extension
ext-pdo_mysql          8.1.1    The pdo_mysql PHP extension
ext-pdo_pgsql          8.1.1    The pdo_pgsql PHP extension
ext-pdo_sqlite         8.1.1    The pdo_sqlite PHP extension
ext-phar               8.1.1    The Phar PHP extension
ext-readline           8.1.1    The readline PHP extension
ext-reflection         8.1.1    The Reflection PHP extension
ext-session            8.1.1    The session PHP extension
ext-simplexml          8.1.1    The SimpleXML PHP extension
ext-soap               8.1.1    The soap PHP extension
ext-sockets            8.1.1    The sockets PHP extension
ext-sodium             8.1.1    The sodium PHP extension
ext-spl                8.1.1    The SPL PHP extension
ext-sqlite3            8.1.1    The sqlite3 PHP extension
ext-tokenizer          8.1.1    The tokenizer PHP extension
ext-xml                8.1.1    The xml PHP extension
ext-xmlreader          8.1.1    The xmlreader PHP extension
ext-xmlwriter          8.1.1    The xmlwriter PHP extension
ext-xsl                8.1.1    The xsl PHP extension
ext-zip                1.19.5   The zip PHP extension
ext-zlib               8.1.1    The zlib PHP extension
lib-bz2                1.0.8    The bz2 library
lib-curl               7.77.0   The curl library
lib-curl-libssh2       1.10.0   curl libssh2 version
lib-curl-openssl       1.1.1.12 curl OpenSSL version (1.1.1.12)
lib-curl-zlib          1.2.11   curl zlib version
lib-date-timelib       2021.11  date timelib version
lib-date-zoneinfo      2021.5   zoneinfo ("Olson") database for date
lib-fileinfo-libmagic  540      fileinfo libmagic version
lib-gd                 2.0.35   The gd library
lib-gd-freetype        2.9.1    freetype version for gd
lib-gd-libjpeg         8.0      libjpeg version for gd
lib-gd-libpng          1.6.34   libpng version for gd
lib-gd-libxpm          3.5.12   libxpm version for gd
lib-iconv              1.16     The iconv library
lib-libsodium          1.0.18   The libsodium library
lib-libxml             2.9.12   libxml library version
lib-libxslt            1.1.34   The libxslt library
lib-libxslt-libxml     2.9.10   libxml version libxslt is compiled against
lib-mbstring-libmbfl   1.3.2    mbstring libmbfl version
lib-mbstring-oniguruma 6.9.7    mbstring oniguruma version
lib-openssl            1.1.1.12 OpenSSL 1.1.1l  24 Aug 2021
lib-pcre               10.39    The pcre library
lib-pcre-unicode       14.0.0   PCRE Unicode version support
lib-pdo_pgsql-libpq    11.4     libpq for pdo_pgsql
lib-pdo_sqlite-sqlite  3.36.0   The pdo_sqlite-sqlite library
lib-sqlite3-sqlite     3.36.0   The sqlite3-sqlite library
lib-zip-libzip         1.7.1    The zip-libzip library
lib-zlib               1.2.11   The zlib library
php                    8.1.1    The PHP interpreter
php-64bit              8.1.1    The PHP interpreter, 64bit
php-ipv6               8.1.1    The PHP interpreter, with IPv6 support
php-zts                8.1.1    The PHP interpreter, with Zend Thread Safety

On which operating system(s) does the issue occur?

Steps to reproduce the issue.

return FcmMessage::create()
  ->setData(['data1' => 'value', 'data2' => 'value2'])
  ->setNotification(\NotificationChannels\Fcm\Resources\Notification::create()
      ->setTitle('title here')
      ->setBody('body here'))
  ->setAndroid(
      AndroidConfig::create()
          ->setFcmOptions(AndroidFcmOptions::create()->setAnalyticsLabel('analytics'))
          ->setNotification(AndroidNotification::create()->setColor('#0A0A0A'))
  )->setApns(
      ApnsConfig::create()
          ->setFcmOptions(ApnsFcmOptions::create()->setAnalyticsLabel('analytics_ios')));

Error message/Stack trace

[2022-07-04 15:12:11] local.ERROR: A message can only have one of the following targets: condition, token, topic, unknown {"exception":"[object] (NotificationChannels\\Fcm\\Exceptions\\CouldNotSendNotification(code: 0): A message can only have one of the following targets: condition, token, topic, unknown at vendor\\laravel-notification-channels\\fcm\\src\\Exceptions\\CouldNotSendNotification.php:13)
[stacktrace]
#0 vendor\\laravel-notification-channels\\fcm\\src\\FcmChannel.php(84): NotificationChannels\\Fcm\\Exceptions\\CouldNotSendNotification::serviceRespondedWithAnError()
#1 vendor\\laravel\\framework\\src\\Illuminate\\Notifications\\NotificationSender.php(148): NotificationChannels\\Fcm\\FcmChannel->send()
#2 vendor\\laravel\\framework\\src\\Illuminate\\Notifications\\NotificationSender.php(106): Illuminate\\Notifications\\NotificationSender->sendToNotifiable()
#3 vendor\\laravel\\framework\\src\\Illuminate\\Support\\Traits\\Localizable.php(19): Illuminate\\Notifications\\NotificationSender->Illuminate\\Notifications\\{closure}()
#4 vendor\\laravel\\framework\\src\\Illuminate\\Notifications\\NotificationSender.php(109): Illuminate\\Notifications\\NotificationSender->withLocale()
#5 vendor\\laravel\\framework\\src\\Illuminate\\Notifications\\ChannelManager.php(54): Illuminate\\Notifications\\NotificationSender->sendNow()
#6 vendor\\laravel\\framework\\src\\Illuminate\\Notifications\\SendQueuedNotifications.php(104): Illuminate\\Notifications\\ChannelManager->sendNow()
#7 vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(36): Illuminate\\Notifications\\SendQueuedNotifications->handle()
#8 vendor\\laravel\\framework\\src\\Illuminate\\Container\\Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#9 vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#10 vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#11 vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(651): Illuminate\\Container\\BoundMethod::call()
#12 vendor\\laravel\\framework\\src\\Illuminate\\Bus\\Dispatcher.php(128): Illuminate\\Container\\Container->call()
#13 vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(141): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()
#14 vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#15 vendor\\laravel\\framework\\src\\Illuminate\\Bus\\Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then()
#16 vendor\\laravel\\framework\\src\\Illuminate\\Queue\\CallQueuedHandler.php(123): Illuminate\\Bus\\Dispatcher->dispatchNow()
#17 vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(141): Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}()
#18 vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#19 vendor\\laravel\\framework\\src\\Illuminate\\Queue\\CallQueuedHandler.php(125): Illuminate\\Pipeline\\Pipeline->then()
#20 vendor\\laravel\\framework\\src\\Illuminate\\Queue\\CallQueuedHandler.php(69): Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware()
#21 vendor\\laravel\\framework\\src\\Illuminate\\Queue\\Jobs\\Job.php(98): Illuminate\\Queue\\CallQueuedHandler->call()
#22 vendor\\laravel\\framework\\src\\Illuminate\\Queue\\Worker.php(428): Illuminate\\Queue\\Jobs\\Job->fire()
#23 vendor\\laravel\\framework\\src\\Illuminate\\Queue\\Worker.php(378): Illuminate\\Queue\\Worker->process()
#24 vendor\\laravel\\framework\\src\\Illuminate\\Queue\\Worker.php(172): Illuminate\\Queue\\Worker->runJob()
#25 vendor\\laravel\\framework\\src\\Illuminate\\Queue\\Console\\WorkCommand.php(130): Illuminate\\Queue\\Worker->daemon()
#26 vendor\\laravel\\framework\\src\\Illuminate\\Queue\\Console\\WorkCommand.php(114): Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#27 vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle()
#28 vendor\\laravel\\framework\\src\\Illuminate\\Container\\Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#29 vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#30 vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#31 vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(651): Illuminate\\Container\\BoundMethod::call()
#32 vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(136): Illuminate\\Container\\Container->call()
#33 vendor\\symfony\\console\\Command\\Command.php(308): Illuminate\\Console\\Command->execute()
#34 vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(121): Symfony\\Component\\Console\\Command\\Command->run()
#35 vendor\\symfony\\console\\Application.php(998): Illuminate\\Console\\Command->run()
#36 vendor\\symfony\\console\\Application.php(299): Symfony\\Component\\Console\\Application->doRunCommand()
#37 vendor\\symfony\\console\\Application.php(171): Symfony\\Component\\Console\\Application->doRun()
#38 vendor\\laravel\\framework\\src\\Illuminate\\Console\\Application.php(102): Symfony\\Component\\Console\\Application->run()
#39 vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(129): Illuminate\\Console\\Application->run()
#40 artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#41 {main}

Additional information

No response

jeromegamez commented 2 years ago

Hey there, and thanks for providing your list of installed dependencies - this helped my find https://github.com/laravel-notification-channels/fcm/pull/116 - it seems to be an issue with the notification channel, that three targets are passed to the CloudMessage although it accepts only one - you can find some workarounds in the PR comments.

The check in the SDK is three years old and justified.

So, unfortunately, unless I'm missing something there's nothing for me to fix.