{"action":"created","issue":{"url":"https://api.github.com/repos/drupal-graphql/graphql/issues/610","repository_url":"https://api.github.com/repos/drupal-graphql/graphql","labels_url":"https://api.github.com/repos/drupal-graphql/graphql/issues/610/labels{/name}","comments_url":"https://api.github.com/repos/drupal-graphql/graphql/issues/610/comments","events_url":"https://api.github.com/repos/drupal-graphql/graphql/issues/610/events","html_url":"https://github.com/drupal-graphql/graphql/issues/610","id":324016382,"node_id":"MDU6SXNzdWUzMjQwMTYzODI=","number":610,"title":"How to send non cacheable Response?","user":{"login":"akshitggrwl","id":29713124,"node_id":"MDQ6VXNlcjI5NzEzMTI0","avatar_url":"https://avatars0.githubusercontent.com/u/29713124?v=4","gravatar_id":"","url":"https://api.github.com/users/akshitggrwl","html_url":"https://github.com/akshitggrwl","followers_url":"https://api.github.com/users/akshitggrwl/followers","following_url":"https://api.github.com/users/akshitggrwl/following{/other_user}","gists_url":"https://api.github.com/users/akshitggrwl/gists{/gist_id}","starred_url":"https://api.github.com/users/akshitggrwl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akshitggrwl/subscriptions","organizations_url":"https://api.github.com/users/akshitggrwl/orgs","repos_url":"https://api.github.com/users/akshitggrwl/repos","events_url":"https://api.github.com/users/akshitggrwl/events{/privacy}","received_events_url":"https://api.github.com/users/akshitggrwl/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-05-17T13:11:11Z","updated_at":"2018-11-22T12:46:54Z","closed_at":"2018-05-18T03:42:05Z","author_association":"NONE","body":"I have created a mutation for webform submission which triggers an email. The submission is created successfully but the response is not returned.\r\nThe following exception is thrown\r\n`LogicException: The controller result claims to be providing relevant cache metadata, but leaked metadata was detected. Please ensure you are not rendering content too early. Returned object class: Drupal\\Core\\Cache\\CacheableJsonResponse. in Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()`\r\n\r\nThis was the issue with REST module also. [REST module must cache only responses to GET requests](https://www.drupal.org/project/drupal/issues/2626298)\r\nThe email is built in separate render context and it uses tokens from the webform which is same as rendering. Thus the Logic Exception.\r\n\r\nIn the RequestController for graphql, if i send Simple JsonResponse instead of CacheableJsonResponse, no exception is thrown."},"comment":{"url":"https://api.github.com/repos/drupal-graphql/graphql/issues/comments/441020325","html_url":"https://github.com/drupal-graphql/graphql/issues/610#issuecomment-441020325","issue_url":"https://api.github.com/repos/drupal-graphql/graphql/issues/610","id":441020325,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MTAyMDMyNQ==","user":{"login":"Leksat","id":989015,"node_id":"MDQ6VXNlcjk4OTAxNQ==","avatar_url":"https://avatars3.githubusercontent.com/u/989015?v=4","gravatar_id":"","url":"https://api.github.com/users/Leksat","html_url":"https://github.com/Leksat","followers_url":"https://api.github.com/users/Leksat/followers","following_url":"https://api.github.com/users/Leksat/following{/other_user}","gists_url":"https://api.github.com/users/Leksat/gists{/gist_id}","starred_url":"https://api.github.com/users/Leksat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Leksat/subscriptions","organizations_url":"https://api.github.com/users/Leksat/orgs","repos_url":"https://api.github.com/users/Leksat/repos","events_url":"https://api.github.com/users/Leksat/events{/privacy}","received_events_url":"https://api.github.com/users/Leksat/received_events","type":"User","site_admin":false},"created_at":"2018-11-22T12:46:54Z","updated_at":"2018-11-22T12:46:54Z","author_association":"CONTRIBUTOR","body":"After a chat with @pmelab the solution was updated to:\r\n```\r\n  // on a class extending UpdateEntityBase\r\n  public function resolve($value, array $args, ResolveContext $context, ResolveInfo $info) {\r\n    $args['id'] = \\Drupal::currentUser()->id();\r\n    return \\Drupal::service('renderer')\r\n      ->executeInRenderContext(new RenderContext(), function () use ($value, $args, $context, $info) {\r\n        return parent::resolve($value, $args, $context, $info);\r\n      });\r\n  }\r\n```\r\n\r\nI'll created a PR for `UpdateEntityBase::resolve`."}}
{"actor":{"display_login":"Leksat"}}