Getting Following errors while running the comment update Rest service.

{
  "message": "A fatal error occurred: 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\rest\ResourceResponse."
}

Using below json format to test the service:

{
  "_links": {
        "type": {
            "href": "http://localhost/d8_blog/drupal/rest/type/comment/comment"
        }
    },
  "langcode":[{"value":"en"}],
  "subject":[{"value":"New comment created on 01 March2"}],
  "uid":[{"target_id":"1"}],
  "status":[{"value":"1"}],
  "comment_type":[{"target_id":"comment"}],
  "default_langcode":[{"value":"1"}],
  "comment_body":[{"value":"<p>New body...</p>","format":"basic_html"}]
}

Comments

rashid_786 created an issue. See original summary.

rashid_786’s picture

Issue summary: View changes
rashid_786’s picture

Category: Support request » Bug report
swentel’s picture

Component: cache system » rest.module
Issue tags: -REST API, -REST
Wim Leers’s picture

Issue tags: +D8 cacheability
catch’s picture

Status: Active » Closed (duplicate)
sblommers’s picture

I have this also with a get request when using:

  return $this->entityManager->getStorage('node')->load(1);

in my ServiceDefinition (services module). Seems like toUrl() somewhere is calling a render out of the context ?