Skip to content

perf(graphql): use depth 0 in auth/apiKey for graphQL requests#13895

Merged
DanRibbens merged 2 commits intopayloadcms:mainfrom
rjgtav:rjgtav/perf-auth-apikey
Sep 24, 2025
Merged

perf(graphql): use depth 0 in auth/apiKey for graphQL requests#13895
DanRibbens merged 2 commits intopayloadcms:mainfrom
rjgtav:rjgtav/perf-auth-apikey

Conversation

@rjgtav
Copy link
Copy Markdown
Contributor

@rjgtav rjgtav commented Sep 22, 2025

What?

Sets depth to 0 when finding the corresponding user in auth/apiKey.
This matches the current behavior of auth/jwt

Why?

Optimizes the authentication step by making just one database query instead of two, when using sessions. Particularly impactful when there's latency between Payload and the database

How?

By leveraging the already existing isGraphQL flag of the AuthStrategyFunction

@rjgtav rjgtav changed the title perf(auth): use depth 0 in auth/apiKey for graphQL requests perf(graphql): use depth 0 in auth/apiKey for graphQL requests Sep 22, 2025
@rjgtav rjgtav force-pushed the rjgtav/perf-auth-apikey branch from f237939 to 42c3825 Compare September 22, 2025 15:05
@DanRibbens DanRibbens merged commit 9a59562 into payloadcms:main Sep 24, 2025
89 checks passed
@DanRibbens
Copy link
Copy Markdown
Contributor

Thanks @rjgtav!

@github-actions
Copy link
Copy Markdown
Contributor

🚀 This is included in version v3.57.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants