Main property for mailchimp_lists_subscription field type is value, it should be subscribe instead

Created on 17 October 2022, over 1 year ago
Updated 15 September 2023, 10 months ago

Problem/Motivation

While working on a headless drupal site, we are using this field and when we submit data from frontend I always get the below error -

Error: Call to a member function getClass() on null in Drupal\hal\Normalizer\FieldItemNormalizer->constructValue() (line 242 of /app/web/core/modules/serialization/src/Normalizer/FieldableEntityNormalizerTrait.php)

#0 /app/web/core/modules/hal/src/Normalizer/FieldItemNormalizer.php(62): Drupal\hal\Normalizer\FieldItemNormalizer->constructValue(true, Array)
#1 /app/vendor/symfony/serializer/Serializer.php(182): Drupal\hal\Normalizer\FieldItemNormalizer->denormalize(true, 'Drupal\\mailchim...', 'hal_json', Array)
#2 /app/web/core/modules/serialization/src/Normalizer/FieldNormalizer.php(52): Symfony\Component\Serializer\Serializer->denormalize(true, 'Drupal\\mailchim...', 'hal_json', Array)
#3 /app/vendor/symfony/serializer/Serializer.php(182): Drupal\serialization\Normalizer\FieldNormalizer->denormalize(Array, 'Drupal\\Core\\Fie...', 'hal_json', Array)
#4 /app/web/core/modules/serialization/src/Normalizer/FieldableEntityNormalizerTrait.php(151): Symfony\Component\Serializer\Serializer->denormalize(Array, 'Drupal\\Core\\Fie...', 'hal_json', Array)
#5 /app/web/core/modules/hal/src/Normalizer/ContentEntityNormalizer.php(195): Drupal\hal\Normalizer\ContentEntityNormalizer->denormalizeFieldData(Array, Object(Drupal\user\Entity\User), 'hal_json', Array)
#6 /app/vendor/symfony/serializer/Serializer.php(182): Drupal\hal\Normalizer\ContentEntityNormalizer->denormalize(Array, 'Drupal\\user\\Ent...', 'hal_json', Array)
#7 /app/web/core/modules/rest/src/RequestHandler.php(196): Symfony\Component\Serializer\Serializer->denormalize(Array, 'Drupal\\user\\Ent...', 'hal_json', Array)
#8 /app/web/core/modules/rest/src/RequestHandler.php(79): Drupal\rest\RequestHandler->deserialize(Object(Drupal\Core\Routing\RouteMatch), Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\cg_auth\Plugin\rest\resource\UserRegistrationResource))
#9 [internal function]: Drupal\rest\RequestHandler->handle(Object(Drupal\Core\Routing\RouteMatch), Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\rest\Entity\RestResourceConfig))
#10 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#11 /app/web/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#12 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))

Steps to reproduce

Add the field to user entity and create a new entity using api.

Proposed resolution

We implement mainPropertyName method in the MailchimpListsSubscription class and return 'subscribe'.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Lists Module

Created by

🇮🇳India sorabh.v6 Indore

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024