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: 281s
    #193135
  • Pipeline finished with Failed
    about 1 year ago
    Total: 197s
    #206954
  • Pipeline finished with Canceled
    about 1 year ago
    Total: 117s
    #206973
  • Pipeline finished with Canceled
    about 1 year ago
    #206980
  • 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
    about 1 year 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
    about 1 year ago
    Total: 313s
    #221496
  • Pipeline finished with Success
    about 1 year ago
    Total: 2689s
    #222267
  • 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 Failed
    about 1 year ago
    Total: 311s
    #222495
  • Pipeline finished with Failed
    about 1 year ago
    #225761
  • Pipeline finished with Failed
    about 1 year ago
    #229847
  • Pipeline finished with Failed
    about 1 year ago
    Total: 301s
    #229851
  • Pipeline finished with Success
    about 1 year ago
    Total: 280s
    #229856
  • Pipeline finished with Success
    about 1 year ago
    Total: 294s
    #229860
  • Pipeline finished with Success
    about 1 year ago
    Total: 294s
    #229961
  • Pipeline finished with Failed
    about 1 year ago
    Total: 303s
    #230031
  • Pipeline finished with Success
    about 1 year ago
    Total: 281s
    #230039
  • Pipeline finished with Skipped
    about 1 year ago
    #233418
  • Pipeline finished with Success
    about 1 year ago
    Total: 467s
    #255109
  • Pipeline finished with Failed
    about 1 year ago
    Total: 201s
    #260481
  • Pipeline finished with Success
    about 1 year ago
    #261007
  • Pipeline finished with Success
    about 1 year ago
    Total: 207s
    #261870
  • Pipeline finished with Success
    about 1 year ago
    Total: 649s
    #268348
  • Pipeline finished with Skipped
    about 1 year ago
    #269717
  • Pipeline finished with Failed
    about 1 year ago
    Total: 547s
    #270313
  • Pipeline finished with Failed
    about 1 year ago
    Total: 284s
    #277005
  • Pipeline finished with Success
    about 1 year ago
    Total: 220s
    #277145
  • Pipeline finished with Failed
    about 1 year ago
    Total: 255s
    #279859
  • Pipeline finished with Success
    about 1 year ago
    Total: 421s
    #280442
  • Pipeline finished with Success
    about 1 year ago
    Total: 229s
    #282178
  • Pipeline finished with Success
    about 1 year ago
    Total: 230s
    #282277
  • Pipeline finished with Canceled
    12 months ago
    Total: 49s
    #293018
  • Pipeline finished with Failed
    12 months ago
    Total: 509s
    #293040
  • Pipeline finished with Failed
    12 months ago
    Total: 217s
    #293209
  • Pipeline finished with Canceled
    12 months ago
    Total: 141s
    #298070
  • Pipeline finished with Failed
    12 months ago
    Total: 251s
    #298071
  • Pipeline finished with Failed
    10 months ago
    Total: 241s
    #354107
  • Pipeline finished with Failed
    9 months ago
    Total: 265s
    #362295
  • Pipeline finished with Failed
    9 months ago
    Total: 213s
    #362299
  • Pipeline finished with Success
    9 months ago
    Total: 148s
    #372938
  • Pipeline finished with Success
    9 months ago
    Total: 179s
    #374049
  • Pipeline finished with Failed
    8 months ago
    Total: 238s
    #399603
  • Pipeline finished with Failed
    8 months ago
    Total: 125s
    #399628
  • Pipeline finished with Failed
    8 months ago
    Total: 130s
    #399633
  • Pipeline finished with Failed
    8 months ago
    Total: 131s
    #399634
  • Pipeline finished with Success
    8 months ago
    Total: 144s
    #405656
  • Pipeline finished with Success
    7 months ago
    Total: 591s
    #418410
  • Pipeline finished with Success
    7 months ago
    Total: 631s
    #418414
  • Pipeline finished with Success
    7 months ago
    Total: 366s
    #419342
  • Pipeline finished with Success
    7 months ago
    Total: 546s
    #419627
  • Pipeline finished with Success
    7 months ago
    #433835
  • Pipeline finished with Success
    7 months ago
    Total: 371s
    #440475
  • Pipeline finished with Failed
    6 months ago
    Total: 466s
    #445200
  • Pipeline finished with Canceled
    6 months ago
    Total: 162s
    #453545
  • Pipeline finished with Canceled
    6 months ago
    Total: 163s
    #459511
  • Pipeline finished with Success
    6 months ago
    Total: 174s
    #459513
  • Pipeline finished with Success
    6 months ago
    Total: 307s
    #459520
  • Pipeline finished with Canceled
    6 months ago
    #460963
  • Pipeline finished with Canceled
    6 months ago
    #460964
  • Pipeline finished with Success
    6 months ago
    Total: 320s
    #462355
  • Pipeline finished with Skipped
    5 months ago
    #473227
  • Pipeline finished with Failed
    5 months ago
    Total: 294s
    #482342
  • Pipeline finished with Failed
    5 months ago
    Total: 287s
    #482343
  • Pipeline finished with Failed
    5 months ago
    Total: 233s
    #482352
  • Pipeline finished with Failed
    5 months ago
    Total: 175s
    #482354
  • Pipeline finished with Success
    4 months ago
    Total: 338s
    #491326
  • Pipeline finished with Success
    4 months ago
    Total: 188s
    #491354
  • Pipeline finished with Canceled
    4 months ago
    Total: 177s
    #503132
  • Pipeline finished with Canceled
    4 months ago
    Total: 381s
    #503134
  • Pipeline finished with Success
    4 months ago
    Total: 416s
    #503142
  • Pipeline finished with Success
    4 months ago
    #505505
  • Pipeline finished with Success
    4 months ago
    #509655
  • Pipeline finished with Success
    4 months ago
    Total: 157s
    #512544
  • Pipeline finished with Success
    3 months ago
    Total: 139s
    #513975
  • Pipeline finished with Success
    3 months ago
    Total: 208s
    #515453
  • Pipeline finished with Skipped
    3 months ago
    #518695
  • Pipeline finished with Failed
    3 months ago
    Total: 530s
    #536577
  • Pipeline finished with Failed
    3 months ago
    Total: 358s
    #536586
  • Pipeline finished with Success
    3 months ago
    Total: 456s
    #536595
  • Pipeline finished with Failed
    3 months ago
    Total: 174s
    #536635
  • Pipeline finished with Failed
    3 months ago
    Total: 587s
    #536648
  • Pipeline finished with Canceled
    3 months ago
    Total: 483s
    #537639
  • Pipeline finished with Success
    3 months ago
    Total: 313s
    #537644
  • Pipeline finished with Success
    2 months ago
    Total: 653s
    #539923
  • Pipeline finished with Success
    about 1 month ago
    Total: 144s
    #563556
  • Pipeline finished with Success
    about 1 month ago
    Total: 263s
    #563580
  • Pipeline finished with Success
    about 1 month ago
    Total: 146s
    #564431
  • Pipeline finished with Success
    about 1 month ago
    Total: 145s
    #564436
  • Pipeline finished with Success
    about 1 month ago
    Total: 182s
    #573813
  • Pipeline finished with Success
    about 1 month ago
    Total: 153s
    #574003
  • Pipeline finished with Canceled
    30 days ago
    Total: 931s
    #574776
  • Pipeline finished with Failed
    26 days ago
    Total: 139s
    #578190
  • Pipeline finished with Failed
    21 days ago
    Total: 437453s
    #578207
  • Pipeline finished with Failed
    20 days ago
    Total: 253s
    #582388
  • Pipeline finished with Success
    15 days ago
    Total: 172s
    #587017
  • Pipeline finished with Failed
    8 days ago
    Total: 177s
    #592961
  • Pipeline finished with Failed
    5 days ago
    Total: 1013s
    #595503
  • Pipeline finished with Failed
    4 days ago
    Total: 385s
    #597188
  • Pipeline finished with Success
    about 17 hours ago
    Total: 1091s
    #599106
  • Pipeline finished with Canceled
    about 15 hours ago
    Total: 1083s
    #599240
  • Pipeline finished with Failed
    about 13 hours ago
    Total: 197s
    #599392
Production build 0.71.5 2024