Problem/Motivation

After upgrading drupal from 9.3.1 to 9.4.2 with jsonapi_extras version 8.x-3.21 and this patch applied: https://www.drupal.org/files/issues/2020-12-02/3042467-50.patch from https://www.drupal.org/project/drupal/issues/3042467

Resulted in Drupal throwing this error:

In ContainerBuilder.php line 1030:
                                                                                             
  You have requested a non-existent service "serializer.normalizer.content_entity.jsonapi". 

The https://www.drupal.org/files/issues/2020-12-02/3042467-50.patch patch both aliases and decorates the serializer.normalizer.content_entity.jsonapi which appears to work fine prior to drupal 9.4.2.

The supplied patch updates jsonapi_extras to decorate the alias instead and that allows drupal to bootrstrap once again.
To be honest I don't know why it works, but it does.

Steps to reproduce

I haven't had the chance yet to configure a core drupal with the appropriate patch.
But generally it should be.

* Install drupal 9.4.1

* Apply patch https://www.drupal.org/files/issues/2020-12-02/3042467-50.patch from https://www.drupal.org/project/drupal/issues/3042467

* Update drupal to 9.4.2

* run drush cr

Get this error:

In ContainerBuilder.php line 1030:
                                                                                             
  You have requested a non-existent service "serializer.normalizer.content_entity.jsonapi". 

Proposed resolution

Modify jsonapi_extras.services.yml to decorate the alias provided by the patch rather than the core service name.

Remaining tasks

Update https://www.drupal.org/project/drupal/issues/3042467 to reflect this the appropriate fix probably should be in that issue.

API changes

The core serializer.normalizer.content_entity.jsonapi is renamed.

Comments

thursday_bw created an issue. See original summary.

thursday_bw’s picture

mxr576’s picture

I am quoting my comment from #3042467: Support entities that are neither content nor config entities:

@thursday_bw I have also experienced the issue that you have mentioned in #59 but only on Drupal 9.4.x. This is a pretty weird one. I did some debugging and I believe this line causes that problem because if I change (correct?) that line to $original = $container->getDefinition($service_id); then the issue disappears. Also, the good new is that this code was removed and deprecated and removed since Drupal 9.5.0, see https://github.com/drupal/core/blob/10.0.3/lib/Drupal/Core/DependencyInj... and #2531564: Fix leaky and brittle container serialization solution.

mxr576’s picture

Update, update, the Core patch could have caused this issue: https://www.drupal.org/project/drupal/issues/3042467#comment-14940083

But when that core patch finally lands, the change in #2 becomes necessary.