microsoftgraph / msgraph-sdk-php

Microsoft Graph Library for PHP.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GraphRequestAdapter must be a subclass of SerializationWriterFactory::class

uncaught opened this issue · comments

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.

We need this fixed too...

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.

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.

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.

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