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

Created on 22 November 2023, over 1 year ago
Updated 12 July 2024, 8 months 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
    9 months ago
    Total: 274s
    #193128
  • Pipeline finished with Success
    9 months ago
    Total: 296s
    #193130
  • Pipeline finished with Failed
    9 months ago
    Total: 281s
    #193135
  • Pipeline finished with Failed
    9 months ago
    Total: 197s
    #206954
  • Pipeline finished with Failed
    9 months ago
    Total: 143s
    #206964
  • Pipeline finished with Canceled
    9 months ago
    Total: 117s
    #206973
  • Pipeline finished with Failed
    9 months ago
    Total: 174s
    #206974
  • Pipeline finished with Canceled
    9 months ago
    #206980
  • Pipeline finished with Failed
    9 months ago
    Total: 170s
    #206999
  • Pipeline finished with Success
    9 months 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

  • Pipeline finished with Failed
    8 months ago
    Total: 249s
    #221478
  • 🇳🇱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 Failed
    8 months ago
    Total: 313s
    #221496
  • Pipeline finished with Success
    8 months ago
    Total: 245s
    #221919
  • Pipeline finished with Success
    8 months ago
    Total: 2689s
    #222267
  • Status changed to Needs review 8 months 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 Failed
    8 months ago
    Total: 311s
    #222495
  • Pipeline finished with Success
    8 months ago
    Total: 238s
    #222501
  • Pipeline finished with Failed
    8 months ago
    Total: 308s
    #225753
  • Pipeline finished with Failed
    8 months ago
    Total: 331s
    #225756
  • Pipeline finished with Failed
    8 months ago
    #225761
  • Pipeline finished with Failed
    8 months ago
    Total: 292s
    #226399
  • Pipeline finished with Failed
    8 months ago
    #229847
  • Pipeline finished with Failed
    8 months ago
    Total: 301s
    #229851
  • Pipeline finished with Success
    8 months ago
    Total: 280s
    #229856
  • Pipeline finished with Success
    8 months ago
    Total: 294s
    #229860
  • Pipeline finished with Success
    8 months ago
    Total: 294s
    #229961
  • Pipeline finished with Failed
    8 months ago
    Total: 303s
    #230031
  • Pipeline finished with Success
    8 months ago
    Total: 281s
    #230039
  • Pipeline finished with Success
    8 months ago
    Total: 188s
    #230062
  • Pipeline finished with Skipped
    8 months ago
    #233418
  • Pipeline finished with Failed
    7 months ago
    #247411
  • Pipeline finished with Success
    7 months ago
    Total: 475s
    #249354
  • Pipeline finished with Success
    7 months ago
    Total: 474s
    #254102
  • Pipeline finished with Success
    7 months ago
    Total: 467s
    #255109
  • Pipeline finished with Failed
    7 months ago
    Total: 201s
    #260481
  • Pipeline finished with Success
    7 months ago
    #261007
  • Pipeline finished with Failed
    7 months ago
    #261019
  • Pipeline finished with Canceled
    7 months ago
    Total: 83s
    #267333
  • Pipeline finished with Failed
    7 months ago
    Total: 157s
    #267334
  • Pipeline finished with Success
    7 months ago
    Total: 649s
    #268348
  • Pipeline finished with Failed
    7 months ago
    #268528
  • Pipeline finished with Skipped
    7 months ago
    #269717
  • Pipeline finished with Failed
    6 months ago
    Total: 268s
    #270305
  • Pipeline finished with Failed
    6 months ago
    Total: 547s
    #270313
  • Pipeline finished with Skipped
    6 months ago
    #270451
  • Pipeline finished with Success
    6 months ago
    Total: 273s
    #271801
  • Pipeline finished with Failed
    6 months ago
    Total: 152s
    #272195
  • Pipeline finished with Success
    6 months ago
    Total: 392s
    #276823
  • Pipeline finished with Failed
    6 months ago
    #276986
  • Pipeline finished with Failed
    6 months ago
    Total: 284s
    #277005
  • Pipeline finished with Failed
    6 months ago
    #277011
  • Pipeline finished with Success
    6 months ago
    Total: 191s
    #278801
  • Pipeline finished with Failed
    6 months ago
    Total: 255s
    #279859
  • Pipeline finished with Success
    6 months ago
    Total: 421s
    #280442
  • Pipeline finished with Success
    6 months ago
    Total: 229s
    #282178
  • Pipeline finished with Canceled
    6 months ago
    Total: 49s
    #293018
  • Pipeline finished with Failed
    6 months ago
    Total: 509s
    #293040
  • Pipeline finished with Failed
    6 months ago
    Total: 217s
    #293209
  • Pipeline finished with Failed
    5 months ago
    Total: 242s
    #298054
  • Pipeline finished with Canceled
    5 months ago
    Total: 141s
    #298070
  • Pipeline finished with Failed
    5 months ago
    Total: 251s
    #298071
  • Pipeline finished with Success
    4 months ago
    Total: 881s
    #330396
  • Pipeline finished with Success
    4 months ago
    Total: 392s
    #330574
  • Pipeline finished with Success
    4 months ago
    Total: 267s
    #347187
  • Pipeline finished with Failed
    4 months ago
    Total: 241s
    #354107
  • Pipeline finished with Success
    3 months ago
    Total: 294s
    #358492
  • Pipeline finished with Success
    3 months ago
    Total: 244s
    #361188
  • Pipeline finished with Failed
    3 months ago
    Total: 265s
    #362295
  • Pipeline finished with Failed
    3 months ago
    Total: 213s
    #362299
  • Pipeline finished with Failed
    3 months ago
    Total: 186s
    #362308
  • Pipeline finished with Success
    3 months ago
    Total: 210s
    #362318
  • Pipeline finished with Success
    3 months ago
    Total: 159s
    #362320
  • Pipeline finished with Success
    3 months ago
    Total: 293s
    #369242
  • Pipeline finished with Success
    3 months ago
    Total: 147s
    #372930
  • Pipeline finished with Success
    3 months ago
    Total: 148s
    #372938
  • Pipeline finished with Success
    3 months ago
    Total: 179s
    #374049
  • Pipeline finished with Success
    3 months ago
    Total: 176s
    #374050
  • Pipeline finished with Skipped
    3 months ago
    #374932
  • Pipeline finished with Failed
    about 2 months ago
    Total: 135s
    #399600
  • Pipeline finished with Failed
    about 2 months ago
    Total: 128s
    #399619
  • Pipeline finished with Failed
    about 2 months ago
    Total: 125s
    #399628
  • Pipeline finished with Failed
    about 2 months ago
    Total: 130s
    #399633
  • Pipeline finished with Failed
    about 2 months ago
    Total: 131s
    #399634
  • Pipeline finished with Failed
    about 2 months ago
    Total: 136s
    #399635
  • Pipeline finished with Failed
    about 2 months ago
    Total: 135s
    #399639
  • Pipeline finished with Canceled
    about 2 months ago
    Total: 73s
    #400048
  • Pipeline finished with Success
    about 2 months ago
    Total: 144s
    #405656
  • Pipeline finished with Success
    about 2 months ago
    Total: 220s
    #406443
  • Pipeline finished with Success
    about 1 month ago
    Total: 146s
    #408618
  • Pipeline finished with Success
    about 1 month ago
    Total: 250s
    #417861
  • Pipeline finished with Success
    about 1 month ago
    Total: 366s
    #419342
  • Pipeline finished with Success
    about 1 month ago
    Total: 546s
    #419627
  • Pipeline finished with Success
    about 1 month ago
    Total: 225s
    #420330
  • Pipeline finished with Success
    17 days ago
    #433835
  • Pipeline finished with Success
    16 days ago
    Total: 345s
    #434851
  • Pipeline finished with Success
    16 days ago
    Total: 185s
    #434871
  • Pipeline finished with Success
    9 days ago
    Total: 371s
    #440475
  • Pipeline finished with Failed
    3 days ago
    Total: 194s
    #445198
  • Pipeline finished with Failed
    3 days ago
    Total: 466s
    #445200
  • Pipeline finished with Failed
    3 days ago
    Total: 269s
    #445202
  • Pipeline finished with Failed
    about 24 hours ago
    Total: 311s
    #447395
Production build 0.71.5 2024