Drupal: LogicException: The controller result claims to be providing relevant cache metadata, but leaked metadata was detected.

Created on 25 January 2023, over 1 year ago
Updated 22 September 2023, 9 months ago

Problem/Motivation

When posting to following endpoint /rest/create-account?_format=json, following error is thrown:

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\rest\ResourceResponse. in Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (line 154 of /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php).

Steps to reproduce

Make a POST request with "mail" and "pass" to the following endpoint: /rest/create-account?_format=json

Proposed resolution

Because it is a POST request we need to use ModifiedResourceResponse instead of ResourceResponse

πŸ› Bug report
Status

Closed: outdated

Version

2.1

Component

Code

Created by

πŸ‡¨πŸ‡­Switzerland nataliajustice

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

Comments & Activities

Production build 0.69.0 2024