DataProducerProxy then() returns SyncPromise

Created on 10 July 2025, 17 days ago

When using a producer for a field returns a Deferred, I'm getting back a Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerProxy::prepare(): Return value must be of type GraphQL\Deferred|Drupal\graphql\Plugin\DataProducerPluginInterface, GraphQL\Executor\Promise\Adapter\SyncPromise returned

In vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromise.php

then() has $tmp = new self();

Meaning the object is now a SyncPromise.

in web/modules/contrib/graphql/src/Plugin/GraphQL/DataProducer/DataProducerProxy.php

protected function prepare(mixed $value, array $args, ResolveContext $context, ResolveInfo $info, FieldContext $field): Deferred|DataProducerPluginInterface {

could be changed to

protected function prepare(mixed $value, array $args, ResolveContext $context, ResolveInfo $info, FieldContext $field): Deferred|SyncPromise|DataProducerPluginInterface {

to allow for then() resolution.

🐛 Bug report
Status

Active

Version

5.0

Component

Code

Created by

🇦🇺Australia almunnings Melbourne, 🇦🇺

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024