[Feature] Add server-side App Events logging - #3368
Open
kristianpd wants to merge 3 commits into
Open
Conversation
5 tasks
kristianpd
force-pushed
the
app-events-log
branch
2 times, most recently
from
August 27, 2026 12:28
82744d3 to
fd875eb
Compare
kristianpd
marked this pull request as ready for review
August 27, 2026 12:28
kristianpd
force-pushed
the
app-events-log
branch
5 times, most recently
from
August 27, 2026 14:52
91f9f28 to
cf13a70
Compare
kristianpd
commented
Aug 27, 2026
| hostName: '', | ||
| hostScheme: 'https', | ||
| globalApiUrl: 'https://api.shopify.com', | ||
| globalApiVersion: GlobalApiVersion.July26, |
Contributor
Author
There was a problem hiding this comment.
welcome advice on how to default here to be backward compatible
kristianpd
force-pushed
the
app-events-log
branch
from
August 27, 2026 17:00
cf13a70 to
dbc281a
Compare
Add `shopify.appEvents.log()` for sending one App Event to Shopify, and `shopify.auth.globalApiClientCredentials()` for minting the app-level token it uses. Both authenticate with the `apiKey` and `apiSecretKey` already in the config, so no shop session is required. The token is cached per config until shortly before it expires, concurrent mints are coalesced into one request, and a 401 refreshes the token and retries the event exactly once. Validate every documented constraint before making a request: shop ID form, idempotency key length, attribute count, key pattern, value types, string length, and the five-minute future bound on the timestamp. `attributes` is required by the API, so it is required here and always sent, empty or not. Pin the Global API version the library targets rather than deriving it from `config.apiVersion`. The Global API is versioned separately from the Admin API even where the version strings line up. Add `globalApiUrl` to reach a non-production Global API. Keep the token request body out of the debug logs through a new `logBody` option, and serialize the top-level `error` and OAuth `error_description` that the Global API returns so a rejection no longer throws with nothing from the server in the message.
kristianpd
force-pushed
the
app-events-log
branch
from
August 28, 2026 14:04
d619d3f to
c96c7f4
Compare
maxwell-blamauer
approved these changes
Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
Apps need to send server-side App Events without a shop session. The Global API uses an app-level client-credentials token, while the existing
clientCredentials({shop})flow returns a shop-scoped Admin API session.WHAT is this pull request doing?
shopify.auth.globalApiClientCredentials()to mint and cache app-level Global API tokens from the configured API key and secret.shopify.log()to validate and send one App Event, refresh once after a401, and report idempotent replays.401s.Type of change
Verification
pnpm --filter @shopify/shopify-api test— 693 tests passedpnpm --filter @shopify/shopify-api buildpnpm lintpnpm prettier2026-07,2026-10, andunstableChecklist
pnpm changesetto create a draft changelog entry (do NOT update theCHANGELOG.mdfiles manually)