Problem/Motivation

Trying to access the bat_event entity endpoint I get the following error:
The website encountered an unexpected error. Please try again later.<br><br><em class="placeholder">Drupal\Component\Plugin\Exception\ContextException</em>: The bat_event context is not a valid context. in <em class="placeholder">Drupal\Core\Plugin\ContextAwarePluginBase-&gt;getContextDefinition()</em> (line <em class="placeholder">184</em> of <em class="placeholder">core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php</em>).

Proposed resolution

Update each Deriver defined with the module to include the 'context_definitions' instead of the 'context'.

CommentFileSizeAuthor
#2 services-3347225.patch3.77 KBalina.basarabeanu

Comments

Alina Basarabeanu created an issue. See original summary.

alina.basarabeanu’s picture

StatusFileSize
new3.77 KB
alina.basarabeanu’s picture

Status: Active » Needs review
anybody’s picture

Version: 8.x-4.0-beta7 » 5.x-dev

The same happens for the user endpoint!

anybody’s picture

Priority: Normal » Critical
Status: Needs review » Reviewed & tested by the community

Whao, GREAT Work! The patch fixes the issue and also fixes many other side-effects, like for example broken access checking for the entities in

$route->setRequirement('_entity_access', $this->getDerivativeId() . '.view');

In Drupal 10 the module isn't working propely without this patch, so I'm setting priority to critical. The patch works as expected.

Any active maintainer?

anybody’s picture

Title: The context is not a valid context. » The context is not a valid context (entity get returns empty string message)

Symptom:

If you're trying to get an entity value and this is the response:

{
  "message": ""
}

then this issue is the correct fix ;)

  • jcnventura committed 1ba1a9f4 on 5.x
    Issue #3347225 by Alina Basarabeanu, Anybody, jcnventura: The context is...
jcnventura’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.