ShopifyPrivacyBanner.showBanner()/showPreferences() types declare zero args, but headless stores require storefrontAccessToken (and domains) at runtime
Maintainers usually reply within 3 days
@minwookshin is already working on this.
Since Oct 2, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, next.js, react, typescript
- Domain
- api, documentation, frontend
Research direction
Look at the TypeScript definitions in dist/globals.d.mts for ShopifyPrivacyBanner types. Examine the compiled storefront-banner.js to see how showBanner and showPreferences handle headless configurations. Update the types to accept storefrontAccessToken and related options, and check the documentation for headless setups. Verify by testing in a headless Next.js storefront with the updated types.
Written by the indexing model from the issue text.
Description
What is the location of your example repository?
No response
Which package or tool is having this issue?
Hydrogen
What version of that package or tool are you using?
shopify/[email protected]
What version of React Router 7 are you using?
Framework: Next.js 16 App Router, via ShopifyScripts/privacyBanner from @shopify/hydrogen/react (not Remix/Hydrogen's Oxygen runtime)
Steps to Reproduce
- Set up a headless Next.js storefront with ShopifyScripts (analytics={{channel: 'headless'}}, consent={{mode: 'default-banner'}}), plus a same-origin SFAPI proxy (handleShopifyRoutes in middleware) per the docs.
- Call window.privacyBanner.showBanner() with no arguments, as the published types require.
- Observe the banner's bannerQuery request to /api/{version}/graphql.json fail with "Online Store channel is locked" — no x-shopify-storefront-access-token header is ever attached.
- Pass {storefrontAccessToken, checkoutRootDomain, storefrontRootDomain, locale, country} into showBanner(...) (requires bypassing the current types with a cast) — the same request now succeeds.
Expected Behavior
- (a) The types should reflect the actual required options for headless stores, and the docs should call out that headless setups must pass storefrontAccessToken (etc.) into showBanner()/showPreferences(), or
- (b) showBanner()/showPreferences() should resolve a token automatically for headless setups the same way other ShopifyScripts-driven consent calls do (e.g. via the #shopify-features liquid-token fallback, or by reusing whatever token/config was already given to ShopifyScripts itself), so headless callers don't have to manually re-supply a token the app already gave to ShopifyScripts.
Actual Behavior
dist/globals.d.mts types window.privacyBanner as:
type ShopifyPrivacyBanner = {
showPreferences: () => Promise<void>;
showBanner: () => Promise<void>;
};
implying no configuration is needed once ShopifyScripts has bootstrapped the page. But in the compiled storefront-banner.js (https://cdn.shopify.com/shopifycloud/privacy-banner/storefront-banner.js), both methods are thin wrappers around the same internal loader the old loadBanner(options) API used:
n.showBanner = function () {
return t(this, arguments, void 0, function (n) {
// ...
return [4, rr(e(e({}, n), { showPreferences: !1, forceShow: !0 }))];
});
};
For a headless storefront (window.Shopify.customerPrivacy.config.isHeadless === true, set when ShopifyScripts is given analytics={{channel: 'headless'}}), the internal getServerData(...) call used to fetch the banner's own content explicitly skips the #shopify-features liquid-token fallback that non-headless/non-banner consent calls use:
this.accessToken = null != e ? e : a ? void 0 : this.liquidAccessToken();
// a === isHeadless -> skips liquidAccessToken() entirely, accessToken stays undefined
So unless a storefrontAccessToken (plus checkoutRootDomain/storefrontRootDomain/locale/country) is explicitly passed into showBanner(options)/showPreferences(options), the banner's own bannerQuery request (proxied through the app's same-origin SFAPI proxy, per the documented headless request-handler pattern) goes out with no Storefront Access Token attached at all, and the Storefront API responds with:
{"errors":[{"message":"Online Store channel is locked.","extensions":{"code":"BAD_REQUEST"}}]}
This is confusing for three reasons:
- The TypeScript types don't allow passing these options at all — following the types leads directly into this failure.
- The error message ("Online Store channel is locked") gives no hint that a missing access token is the actual cause.
- Current headless docs (e.g.
shopify.dev/docs/storefronts/headless/hydrogen/analytics/consent, and thehydrogen-analyticsskill bundled with the package) documentshowBanner()/showPreferences()as needing no arguments, with no mention of a headless-specific requirement.
- Dominant language
- TypeScript
- Stars
- 2.2k
- Forks
- 466
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 59
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Shopify/hydrogen
-
Remix 3: running Hydrogen 2026-10's core without a bindingPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 5/5 Over a week Newbie friendliness 12/100
Maintainers usually reply within 3 days
-
`runWithCache` starts a background refresh for every stale hit, where 2025.7 started one per keyPossibly taken @debojyoti10CC claimed this 6 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Maintainers usually reply within 3 days
-
`shopify:page:view` fires when `history.replaceState` changes only the query, as a variant selection doesPossibly taken @Peerapatfc claimed this 6 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 53/100
Maintainers usually reply within 3 days
-
`gql check` and the TS plugin still fail on Windows when schema paths are absolutePossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 5/5 Over a week Newbie friendliness 35/100
Shopify/hydrogen#4371 · 2 comments ·
Maintainers usually reply within 3 days
-
`hydrogen gql check` fails on Windows: absolute schema path is parsed as a URL by gql.tadaPossibly taken @Roshan931 claimed this 12 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 30/100
Shopify/hydrogen#4359 · 1 comment ·
Maintainers usually reply within 3 days
All issues in Shopify/hydrogen
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 66/100
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
prometheus/docs#3198 ·
Maintainers usually reply within 3 days
-
[Bug]: OpenCode v2 skips an assistant message that gains text after an earlier capturePossibly taken @jianyx1 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
volcengine/OpenViking#8354 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ARTPARK-SAHAI-ORG/calibrate-frontend#842 ·
Maintainers usually reply within 1 day
-
Chat: Copying a selection that includes the end of a message also copies the actions menu labelsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
suitenumerique/hub#176 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day