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
Comment #2
m4oliveiUpdated description with steps to repro.
Comment #3
m4oliveiComment #4
m4oliveiTurns out the entity view display was not created correctly. This PR fixes things:
PR: https://github.com/BurdaMagazinOrg/module-fb_instant_articles/pull/106
Comment #5
m4oliveiComment #6
sunset_bill commentedComment #8
m4oliveiMerged.