designcourse icon indicating copy to clipboard operation
designcourse copied to clipboard

💡 Enhance support of persisted Graphql queries

Open valtechtmn opened this issue 3 months ago • 1 comments

Recently support was added for persisted queries through this PR: https://github.com/DataDog/browser-sdk/pull/3992

However there is still a gap that affects anyone using useGETForHashedQueries as is recommended by Apollo's doc: https://www.apollographql.com/docs/apollo-server/performance/apq#step-2-enable-automatic-persisted-queries

In this case any graphql query is a GET instead of a POST and the usual properties (operationName, variables, ...) are passed as query param instead of payload. This means the extractGraphQlRequestMetadata function which is only looking at request body misses the data and extracts nothing.

Would it be possible if the requestBody is empty to check the query params to see if the data is there and then proceed as normal ?

valtechtmn avatar Jan 08 '26 12:01 valtechtmn

Hey @valtechtmn, thanks for the feedback ! I created a ticket and I will let you know once it's merged

rgaignault avatar Jan 08 '26 14:01 rgaignault

Hello @valtechtmn , I have just merged https://github.com/DataDog/browser-sdk/pull/4125. It will be available in the next release.

rgaignault avatar Feb 17 '26 09:02 rgaignault