Skip to content

Cache the Admin API version list in store execute - #9050

Open
hasandenizuk wants to merge 1 commit into
Shopify:mainfrom
hasandenizuk:perf/cache-admin-api-versions
Open

hasandenizuk wants to merge 1 commit into
Shopify:mainfrom
hasandenizuk:perf/cache-admin-api-versions

Conversation

@hasandenizuk

Copy link
Copy Markdown

WHY are these changes introduced?

Every shopify store execute call sends a StoreExecutePublicApiVersions query before the user's own request, to pick or validate the API version. The version list only changes when Shopify releases a new API version, but scripts that run many store execute calls pay this extra round trip (about 0.25 s) on every call.

WHAT is this pull request doing?

fetchPublicApiVersions now passes cacheOptions: {cacheTTL: {hours: 24}} to graphqlRequest, so the version list is cached for a day. cli-kit's cache key already includes the store URL and a hash of the token, and only successful responses are stored. If a user passes --version with a version that is not in the cached list (for example one released today), the version is checked against a fresh, uncached list before the "Invalid API version" error is shown. Includes unit tests and a patch changeset.

How to manually test your changes?

Run shopify store execute --store <store> --query '{ shop { id } }' --verbose twice. Before: both runs send the StoreExecutePublicApiVersions request. After: the second run does not.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the correct bump type (patch for bug fixes · minor for new features · major for breaking changes) and added a changeset with pnpm changeset add

store execute looked up the store's API versions on every call. The list
only changes when Shopify releases a new version, so cache it per store
and token for a day. A requested version missing from the cached list is
checked against a fresh list before it is rejected.
@hasandenizuk
hasandenizuk requested a review from a team as a code owner October 30, 2026 20:19

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant