I had to use JSON API 8.x-1.13 and apply the patch from https://www.drupal.org/files/issues/consumer_image_styles_update-normali... to make the image derivates work again.

Using Drupal 8.5

Comments

valderama created an issue. See original summary.

pixelwhip’s picture

Same here. Downgrading jsonapi to 1.13 along with the patch listed in the description worked for me as well.

TikaL13’s picture

Same here. Below is the error message I'm receiving:

The website encountered an unexpected error. Please try again later.
ArgumentCountError: Too few arguments to function Drupal\jsonapi\Normalizer\Value\NullFieldNormalizerValue::__construct(), 0 passed in /Users/me/project/SourceCode/web/modules/contrib/consumer_image_styles/src/Normalizer/ImageEntityNormalizer.php on line 127 and exactly 2 expected in Drupal\jsonapi\Normalizer\Value\NullFieldNormalizerValue->__construct() (line 32 of modules/contrib/jsonapi/src/Normalizer/Value/NullFieldNormalizerValue.php).

"drupal/consumer_image_styles": "^2.0@RC",
"drupal/jsonapi": "^1.14",
"drupal/jsonapi_extras": "^2.0@RC",
pavel.bulat’s picture

StatusFileSize
new4.67 KB

I wrote a patch that works for me, but I have very little experience with Drupal. Do a review of this patch please.

pavel.bulat’s picture

Status: Active » Needs review
skdrupal88’s picture

Fun, thanks @C5uJI, was just about to publish my own patch too 😃
Attaching it as it might also help.

Attached patch contains workaround fixes and must be reviewed and enhanced by module’s maintainer, use it on your own risk.

Works well to me with following packages:

"drupal/consumer_image_styles": "2.x-dev#2626714”,
"drupal/core": "~8.5.0”,
"drupal/jsonapi": "^1.14",
"drupal/jsonapi_extras": "^2.0”,

Also had to upgrade page_manager and simple_oauth to dev versions during migration to 8.5.1 (if it helps someone)

"drupal/page_manager": "4.x-dev#0ad8885",
"drupal/simple_oauth": "3.x-dev#b07da37", 

Some more errors I’ve experienced during implementation:

ArgumentCountError: Too few arguments to function Drupal\jsonapi\Normalizer\Value\NullFieldNormalizerValue::__construct(), 0 passed in /var/www/html/web/modules/contrib/consumer_image_styles/src/Normalizer/ImageEntityNormalizer.php on line 127 and exactly 2 expected in Drupal\jsonapi\Normalizer\Value\NullFieldNormalizerValue->__construct() (line 32 of modules/contrib/jsonapi/src/Normalizer/Value/NullFieldNormalizerValue.php).

Fatal error: Drupal\jsonapi\Normalizer\Value\FieldItemNormalizerValue and Drupal\Core\Cache\RefinableCacheableDependencyTrait define the same property ($cacheMaxAge) in the composition of Drupal\consumer_image_styles\Normalizer\Value\ImageVariantItemNormalizerValue. However, the definition differs and is considered incompatible. Class was composed in /var/www/html/web/modules/contrib/consumer_image_styles/src/Normalizer/Value/ImageVariantItemNormalizerValue.php on line 15

TypeError: Argument 1 passed to Drupal\consumer_image_styles\Normalizer\Value\ImageNormalizerValue::__construct() must implement interface Drupal\jsonapi\Normalizer\Value\ValueExtractorInterface, instance of Drupal\consumer_image_styles\Normalizer\Value\ImageVariantItemNormalizerValue given, called in /var/www/html/web/modules/contrib/consumer_image_styles/src/Normalizer/ImageEntityNormalizer.php on line 108 in Drupal\consumer_image_styles\Normalizer\Value\ImageNormalizerValue->__construct() (line 29 of modules/contrib/consumer_image_styles/src/Normalizer/Value/ImageNormalizerValue.php).

skdrupal88’s picture

By the way, @C5uJI, I can give you a few advices if you don't mind:
1) Better to include issue and comment numbers into the patch name, like this: [project-name]-[description]-[issue-number]-[comment-number].patch
2) Patch should be made from latest dev version of the module

pavel.bulat’s picture

@skorzh Thanks for the advice, I will try to apply them in practice. =)

e0ipso’s picture

Welcome to our community @C5uJI I hope you enjoy it here! Thank you both for the awesome patches. I'll be adding a requirement to have jsonapi 1.14 or older and merge it.

e0ipso’s picture

Status: Needs review » Fixed

Thanks for fixing this!

  • e0ipso committed 72b2023 on 8.x-2.x authored by skorzh
    Issue #2955296 by C5uJI, skorzh, valderama, pixelwhip, TikaL13: Doesn't...

  • e0ipso committed 496b4c3 on 8.x-2.x authored by C5uJI
    Issue #2955296 by C5uJI, skorzh, valderama, e0ipso, TikaL13, pixelwhip:...
e0ipso’s picture

I created a second commit with credit for @C5uJI to welcome him to our community.

Status: Fixed » Closed (fixed)

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