Problem/Motivation

Under certain conditions, the following error can be throw when serializing a node:

The website encountered an unexpected error. Please try again later.

InvalidArgumentException: Field field_kicker is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 509 of core/lib/Drupal/Core/Entity/ContentEntityBase.php).
Drupal\Core\Entity\ContentEntityBase->get('field_kicker') (Line: 134)
Drupal\fb_instant_articles\Normalizer\InstantArticleContentEntityNormalizer->normalize(Object, 'fbia_rss', Array) (Line: 29)
Drupal\fb_instant_articles\Normalizer\InstantArticleRssContentEntityNormalizer->normalize(Object, 'fbia_rss', Array) (Line: 128)
Symfony\Component\Serializer\Serializer->normalize(Object, 'fbia_rss', Array) (Line: 138)
Symfony\Component\Serializer\Serializer->normalize(Array, 'fbia_rss', Array) (Line: 101)
Symfony\Component\Serializer\Serializer->serialize(Array, 'fbia_rss', Array) (Line: 142)
Drupal\rest\Plugin\views\style\Serializer->render() (Line: 411)
Drupal\rest\Plugin\views\display\RestExport->Drupal\rest\Plugin\views\display\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 412)
Drupal\rest\Plugin\views\display\RestExport->render() (Line: 1519)
Drupal\views\ViewExecutable->render() (Line: 402)
Drupal\rest\Plugin\views\display\RestExport->execute() (Line: 1616)
Drupal\views\ViewExecutable->executeDisplay('fbia_rss', Array) (Line: 78)
Drupal\views\Element\View::preRenderViewElement(Array)
call_user_func(Array, Array) (Line: 376)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 139)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 140)
Drupal\Core\Render\Renderer->renderRoot(Array) (Line: 385)
Drupal\rest\Plugin\views\display\RestExport::buildResponse('facebook_instant_articles_rss', 'fbia_rss', Array) (Line: 52)
Drupal\views\Routing\ViewPageController->handle('facebook_instant_articles_rss', 'fbia_rss', Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

This seems to happen when you've configured a field on the fb_instant_articles view mode, have serialized some node either via views or API, and then deleted the field.

Minimum steps to repro:

  • Enable fb_instant_aricles_views
  • Enable Facebook Instant Articles on the Article content type
  • Create a new field
  • Move new field into an active region on the Facebook Instant Articles view mode
  • Create a new article
  • View the RSS feed and observe things are OK: /instant-articles.rss
  • Delete the field
  • Clear cache
  • View the RSS feed and observe things are BUSTED: /instant-articles.rss

The problem isn't in the view, it's somewhere in the serialization, you can repro the above using the serializer service in drush php.

Proposed resolution

Find the root cause, fix it.

Remaining tasks

Do eeet.

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

m4olivei created an issue. See original summary.

m4olivei’s picture

Issue summary: View changes

Updated description with steps to repro.

m4olivei’s picture

Assigned: Unassigned » m4olivei
m4olivei’s picture

Turns out the entity view display was not created correctly. This PR fixes things:

PR: https://github.com/BurdaMagazinOrg/module-fb_instant_articles/pull/106

m4olivei’s picture

Status: Active » Needs review
sunset_bill’s picture

Status: Needs review » Reviewed & tested by the community

  • m4olivei committed e7c4d2c on 8.x-2.x
    Issue #2892840 fix the error that crops up later with the way that we...
  • m4olivei authored f594825 on 8.x-2.x
    Issue #2892840 by m4olivei, sunset_bill: Removing a field that was...
m4olivei’s picture

Status: Reviewed & tested by the community » Fixed

Merged.

Status: Fixed » Closed (fixed)

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