- Issue created by @datawench
We have a decoupled site, with the front end built on Gatsby using the gatsby-source-drupal plugin. While the json endpoints may be public, the actual entity access is limited by role. We create an user with a custom "json api access" role, and use the Drupal key_auth plugin to get a key unique to that user. That key is provided in the headers of the requests that the Gatsby application makes to the Drupal site to retrieve and build its data.
The Drupal site has translations enabled, currently providing EN and ES. When hitting a particular resource listing for a language with a properly authenticated query (ex: https://my-site.tld/es/jsonapi/node/my-content-type
) we get "paging links" at the bottom (ex: https://my-site.tld/es/jsonapi/node/my-content-type?page%5Boffset%5D=150&page%5Blimit%5D=50
), which permit the Gatsby builder to walk through and get all the appropriate nodes, so it can then sift through by various criteria including langcode.
Or at least it used to, before we updated Drupal to 10.2.0, and started observing a problem that persists in 10.2.2.
Now, under the conditions I've described, a hit to the EN endpoint (which is really the default: https://my-site.tld/jsonapi/node/my-content-type
) eliminates the langcode in the paging links of the ES endpoint. So for instance:
https://my-site.tld/es/jsonapi/node/my-content-type
returns https://my-site.tld/es/jsonapi/node/my-content-type?page%5Boffset%5D=150&page%5Blimit%5D=50
in the paging links, as expected.https://my-site.tld/jsonapi/node/my-content-type
return https://my-site.tld/jsonapi/node/my-content-type?page%5Boffset%5D=150&page%5Blimit%5D=50
in the paging links, as expected.https://my-site.tld/es/jsonapi/node/my-content-type
again returns https://my-site.tld/jsonapi/node/my-content-type?page%5Boffset%5D=150&page%5Blimit%5D=50
in the paging links. The /es/
portion of the path is gone.Clearing the site cache will correct the problem once, but not for subsequent requests.
Finally... and this is the really odd bit, it all appears to be bound up in authentication.
My supposition is that cache tagging is folding together language and authentication parameters in some way, that's blocking consistent behavior. Our current workaround is a custom event subscriber that forces the cache max age to 0 on any jsonapi path.
Following on all this, I have two questions:
Active
10.2 β¨
Last updated