Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292445

"rendering content too early" error when creating a new custom node

$
0
0

Hi there,
when sending a post request to create a custom content type entity via JSON:API, I keep getting "500 Internal Server Error" response code with an error message like this:
"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\\jsonapi\\ResourceResponse.".

But the entity is still get created on the site.

The custom entity has some basic fields plus two required entity reference fields to taxonomy terms. Here is an example code of the post request:{

POST /api/node/cnjws_post HTTP/1.1
Host: local.test
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Authorization: Basic c25vd2FwaTpzTmFwMjAhOQ==
User-Agent: PostmanRuntime/7.19.0
Cache-Control: no-cache
Postman-Token: 66a6b568-a7ca-43dd-aabd-c2ab54d6c839,65e3c3ad-f66d-447c-91a8-c70b4ab0216a
Host: local.test
Accept-Encoding: gzip, deflate
Content-Length: 777
Connection: keep-alive
cache-control: no-cache

{
  "data": {
    "type": "node--cnjws_post",
    "attributes": {
      "title": "646443536 from json api",
      "field_cnjws_post_contact": "s57575tetone",
      "field_cnjws_post_contact_method": "rt463t5564",
      "field_cnjws_post_content": {
        "value": "e547474ue",
        "format": "plain_text"
      }
     
    },
    "relationships": {
      "field_cnjws_post_category": {
        "data": {
          "type": "taxonomy_term--information_post_category",
          "id": "b28c9d88-d7de-4279-84ab-4940df39c733"
        }
      },
      "field_cnjws_post_location": {
        "data": {
          "type": "taxonomy_term--information_post_location",
          "id": "0af63f2b-cfe0-4a46-9a43-2dc8b397e3fa"
        }
      }
    }
  }
}

The drupal version is 8.7.8 and json:api is enabled as part of core. Any ideas what might go wrong? Thanks.


Viewing all articles
Browse latest Browse all 292445

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>