microsoftgraph / msgraph-sdk-php

Microsoft Graph Library for PHP.
Other
583 stars 144 forks source link

GraphRequestAdapter must be a subclass of SerializationWriterFactory::class #1523

Closed uncaught closed 6 months ago

uncaught commented 6 months ago

Your version 2.8.0 introduced a breaking bug!

InvalidArgumentException: The class passed must be a subclass of SerializationWriterFactory::class
/var/www/html/vendor/microsoft/kiota-abstractions/src/ApiClientBuilder.php:25
/var/www/html/vendor/microsoft/microsoft-graph/src/Generated/BaseGraphClient.php:592
/var/www/html/vendor/microsoft/microsoft-graph/src/GraphServiceClient.php:45
/var/www/html/vendor/microsoft/microsoft-graph/src/GraphServiceClient.php:70
/var/www/html/vendor/microsoft/microsoft-graph/src/GraphServiceClient.php:85

Apparently your own GraphRequestAdapter does not extend SerializationWriterFactory as requested!

Please write tests.

dominicgroza72 commented 6 months ago

We need this fixed too...

SilasKenneth commented 6 months ago

Hi @uncaught, thank you for reporting the issue and I'm sorry for the inconvenience caused. Are you still experiencing the issue? If yes, kindly try doing a composer update to update the dependencies required by the SDK. The issue was supposed to be addressed by This PR. If the issue is gone, please consider closing the issue.

uncaught commented 6 months ago

Hey @SilasKenneth, that PR seems to fix the issue.

However, composer won't update by itself to "microsoft/microsoft-graph-core": "^2.1.1" because that would require a downgrade of php-http/promise from 1.3 to 1.2. Even with composer update -W you won't get 2.1.1. I had to manually add "microsoft/microsoft-graph-core": "^2.1.1" to my composer.json, which is not a good sign:

image

You need to release a new bugfix version of this library, setting "microsoft/microsoft-graph-core": "^2.1.1" as dependency to solve this issue at least.

Then another issue should be added with microsoft/kiota-abstractions as to why they need "php-http/promise": "~1.2.0" and cannot go to 1.3.

SilasKenneth commented 6 months ago

Hi @uncaught, The version bump is included in the next version 2.9.0. For the php-http/promise, we fixed it to that version since we currently depend on the ability to add a Generic type to promise in the doc comment which helps with resolving the type that is returned by .wait() on the promise.

teemukolehmainen-howspace commented 6 months ago

This same issue is happening with "microsoft/microsoft-graph": "^2.10.0" now.

aless673 commented 4 months ago

why this issue is closed ? I just installed this package and did the quickstart, and it immediatly fails with this error

nusagates commented 4 months ago

i just installed this package today and facing the same issue.

MaximilianGewers commented 3 months ago

Running into the same issue after updating to the latest #/components/schemas/microsoft.graph.user schema via kiota generate.

If anybody is following Build API clients for PHP with Microsoft identity authentication and running into the same issues (thats why I am here) it seems that the instructions that talk about adding dependencies are outdated. They are missing:

composer require microsoft/kiota-serialization-multipart
composer require microsoft/kiota-serialization-form

After adding these two my previously working login is working again.

Casmo commented 3 months ago

For this still running into this issue. Set your version fixed on v2.7.0 in composer.json.

{
  "require": {
    "microsoft/microsoft-graph": "2.7.0",
  }
}