microsoftgraph / msgraph-sdk-php

Microsoft Graph Library for PHP.
Other
551 stars 141 forks source link

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

Closed uncaught closed 1 month ago

uncaught commented 1 month 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 1 month ago

We need this fixed too...

SilasKenneth commented 1 month 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 1 month 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 1 month 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 4 weeks ago

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