Pages with includes are cached without (default) included referenced content

Created on 22 November 2023, almost 2 years ago
Updated 12 July 2024, about 1 year ago

Problem/Motivation

JSON:API enpoints seem to be cached without the included references, once the page is manually saved the references will be included.

Steps to reproduce

  1. Create an endpoint with a default include
  2. Maken sure Drupal cache is enabled
  3. Clear the cache (drush cr)
  4. Request the created endpoint (i.e. /jsonapi/node/page/123e4eb4-7f24-4ede-9b76-6fe943dbe3db) and notice the missing includes
  5. Request the endpoint with an extra query parameter (i.e. /jsonapi/node/page/123e4eb4-7f24-4ede-9b76-6fe943dbe3db?resourceVersion=rel:latest-version) and notice all includes are there
  6. Save the entity for which the endpoint was requested (drush entity:save node NID)
  7. Request the first endpoint again and notice the included references are now there as expected with or without the extra parameter.
🐛 Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

🇳🇱Netherlands markwittens

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

Merge Requests

Comments & Activities

  • Issue created by @markwittens
  • Pipeline finished with Failed
    over 1 year ago
    Total: 274s
    #193128
  • Pipeline finished with Success
    over 1 year ago
    Total: 296s
    #193130
  • Pipeline finished with Failed
    about 1 year ago
    Total: 143s
    #206964
  • Pipeline finished with Failed
    about 1 year ago
    Total: 174s
    #206974
  • Pipeline finished with Failed
    about 1 year ago
    Total: 170s
    #206999
  • Pipeline finished with Success
    about 1 year ago
    Total: 269s
    #207214
  • I am having a similar issue, though with different steps to reproduce.

    Steps to reproduce

    1. Create an endpoint with a default include
    2. Make sure Drupal cache is enabled
    3. Clear the cache (and ensure max-age on cache on below requests has also expired)
    4. Request the created endpoint without any includes eg /jsonapi/node/page?include=
    5. Request the created endpoint as default eg /jsonapi/node/page and see that it is serving the response without includes from previous step

    This issue seems to have been introduced with 🐛 Pages with default includes are not cached Fixed in v3.25. If I roll back to 3.24 the issue is not present.

  • 🇳🇱Netherlands bbrala Netherlands

    Ok, so what i understand.

    /jsonapi/node/page?include=: A page with includes cleared.

    is cached the same as

    /jsonapi/node/page: A page with default includes.

    That indeed seems like a regression. We should able to test that pretty easily in this test somewhere:

    JsonApiDefaultsFunctionalTest

  • 🇳🇱Netherlands bbrala Netherlands

    Tried to reproduce in tests, couldn't reproduce the first case (IS) but seems i can reproduce the second case by @cb_dewr.

  • Pipeline finished with Success
    about 1 year ago
    Total: 245s
    #221919
  • Status changed to Needs review about 1 year ago
  • 🇳🇱Netherlands bbrala Netherlands

    I think this is fixed now. Problem was indeed the difference of `include=` versus no include paramter at all. I would love a review on this, perhaps test this patch on your site.

  • Pipeline finished with Success
    about 1 year ago
    Total: 238s
    #222501
  • Pipeline finished with Failed
    about 1 year ago
    Total: 308s
    #225753
  • Pipeline finished with Failed
    about 1 year ago
    Total: 331s
    #225756
  • Pipeline finished with Failed
    about 1 year ago
    Total: 292s
    #226399
  • Pipeline finished with Success
    about 1 year ago
    Total: 188s
    #230062
  • Pipeline finished with Failed
    about 1 year ago
    #247411
  • Pipeline finished with Success
    about 1 year ago
    Total: 475s
    #249354
  • Pipeline finished with Success
    about 1 year ago
    Total: 474s
    #254102
  • Pipeline finished with Success
    about 1 year ago
    Total: 442s
    #257411
  • Pipeline finished with Failed
    about 1 year ago
    #261019
  • Pipeline finished with Canceled
    about 1 year ago
    Total: 83s
    #267333
  • Pipeline finished with Failed
    about 1 year ago
    Total: 157s
    #267334
  • Pipeline finished with Failed
    about 1 year ago
    Total: 268s
    #270305
  • Pipeline finished with Skipped
    about 1 year ago
    #270451
  • Pipeline finished with Success
    about 1 year ago
    Total: 273s
    #271801
  • Pipeline finished with Failed
    about 1 year ago
    Total: 152s
    #272195
  • Pipeline finished with Success
    about 1 year ago
    Total: 392s
    #276823
  • Pipeline finished with Failed
    about 1 year ago
    #276986
  • Pipeline finished with Failed
    about 1 year ago
    #277011
  • Pipeline finished with Success
    about 1 year ago
    Total: 191s
    #278801
  • Pipeline finished with Success
    about 1 year ago
    Total: 218s
    #280983
  • Pipeline finished with Failed
    12 months ago
    Total: 242s
    #298054
  • Pipeline finished with Success
    11 months ago
    Total: 881s
    #330396
  • Pipeline finished with Success
    11 months ago
    Total: 392s
    #330574
  • Pipeline finished with Success
    10 months ago
    Total: 197s
    #342132
  • Pipeline finished with Success
    10 months ago
    Total: 267s
    #347187
  • Pipeline finished with Success
    10 months ago
    Total: 244s
    #361188
  • Pipeline finished with Failed
    10 months ago
    Total: 186s
    #362308
  • Pipeline finished with Success
    10 months ago
    Total: 210s
    #362318
  • Pipeline finished with Success
    10 months ago
    Total: 159s
    #362320
  • Pipeline finished with Success
    9 months ago
    Total: 293s
    #369242
  • Pipeline finished with Success
    9 months ago
    Total: 147s
    #372930
  • Pipeline finished with Success
    9 months ago
    Total: 176s
    #374050
  • Pipeline finished with Skipped
    9 months ago
    #374932
  • Pipeline finished with Failed
    8 months ago
    Total: 135s
    #399600
  • Pipeline finished with Failed
    8 months ago
    Total: 136s
    #399635
  • Pipeline finished with Failed
    8 months ago
    Total: 135s
    #399639
  • Pipeline finished with Canceled
    8 months ago
    Total: 73s
    #400048
  • Pipeline finished with Success
    8 months ago
    Total: 220s
    #406443
  • Pipeline finished with Success
    8 months ago
    Total: 146s
    #408618
  • Pipeline finished with Success
    7 months ago
    Total: 250s
    #417861
  • Pipeline finished with Success
    7 months ago
    Total: 345s
    #434851
  • Pipeline finished with Success
    7 months ago
    Total: 185s
    #434871
  • Pipeline finished with Failed
    6 months ago
    Total: 194s
    #445198
  • Pipeline finished with Failed
    6 months ago
    Total: 269s
    #445202
  • Pipeline finished with Failed
    6 months ago
    Total: 311s
    #447395
  • Pipeline finished with Success
    6 months ago
    Total: 345s
    #453546
  • Pipeline finished with Failed
    6 months ago
    Total: 187s
    #459061
  • Pipeline finished with Success
    6 months ago
    Total: 180s
    #459515
  • Pipeline finished with Success
    6 months ago
    Total: 186s
    #459538
  • Pipeline finished with Failed
    6 months ago
    Total: 486s
    #464392
  • Pipeline finished with Failed
    6 months ago
    Total: 538s
    #464405
  • Pipeline finished with Failed
    5 months ago
    Total: 152s
    #482340
  • Pipeline finished with Success
    5 months ago
    Total: 549s
    #482420
  • Pipeline finished with Success
    5 months ago
    Total: 215s
    #482445
  • Pipeline finished with Success
    5 months ago
    Total: 370s
    #487879
  • Pipeline finished with Success
    4 months ago
    Total: 211s
    #491345
  • Pipeline finished with Failed
    4 months ago
    Total: 191s
    #498737
  • Pipeline finished with Success
    4 months ago
    Total: 287s
    #512648
  • Pipeline finished with Success
    4 months ago
    Total: 157s
    #513989
  • Pipeline finished with Canceled
    3 months ago
    Total: 367s
    #536607
  • Pipeline finished with Canceled
    3 months ago
    Total: 277s
    #536626
  • Pipeline finished with Failed
    3 months ago
    Total: 164s
    #536633
  • Pipeline finished with Failed
    3 months ago
    Total: 199s
    #536637
  • Pipeline finished with Failed
    3 months ago
    Total: 315s
    #536640
  • Pipeline finished with Failed
    3 months ago
    Total: 188s
    #536643
  • Pipeline finished with Failed
    3 months ago
    Total: 265s
    #536644
  • Pipeline finished with Success
    3 months ago
    Total: 429s
    #537628
  • Pipeline finished with Success
    3 months ago
    Total: 304s
    #537650
  • Pipeline finished with Skipped
    3 months ago
    #539466
  • Pipeline finished with Success
    2 months ago
    Total: 248s
    #541981
  • Pipeline finished with Success
    about 2 months ago
    #554775
  • Pipeline finished with Success
    about 2 months ago
    Total: 194s
    #563568
  • Pipeline finished with Success
    about 1 month ago
    #566634
  • Pipeline finished with Success
    about 1 month ago
    Total: 178s
    #567170
  • Pipeline finished with Success
    about 1 month ago
    Total: 159s
    #574007
  • Pipeline finished with Success
    about 1 month ago
    Total: 1134s
    #574781
  • Pipeline finished with Success
    about 1 month ago
    #577405
  • Pipeline finished with Failed
    24 days ago
    Total: 155s
    #581971
  • Pipeline finished with Success
    24 days ago
    Total: 159s
    #582397
  • Pipeline finished with Success
    11 days ago
    #592994
  • Pipeline finished with Failed
    10 days ago
    Total: 158s
    #593827
  • Pipeline finished with Failed
    8 days ago
    Total: 1673s
    #596351
  • Pipeline finished with Failed
    7 days ago
    #597144
  • Pipeline finished with Failed
    4 days ago
    Total: 316s
    #599091
  • Pipeline finished with Canceled
    3 days ago
    Total: 30s
    #599975
  • Pipeline finished with Success
    3 days ago
    Total: 249s
    #599976
  • Pipeline finished with Failed
    3 days ago
    Total: 1356s
    #600357
  • Pipeline finished with Failed
    3 days ago
    Total: 1215s
    #600571
  • Pipeline finished with Failed
    2 days ago
    Total: 861s
    #600716
  • Pipeline finished with Success
    1 day ago
    Total: 11222s
    #601682
  • Pipeline finished with Failed
    about 23 hours ago
    #602352
  • Pipeline finished with Failed
    about 22 hours ago
    #602405
Production build 0.71.5 2024