Upgrade Next to 16.3.8 and default the store domain to mock.shop
An unset or blank NEXT_PUBLIC_SHOPIFY_DOMAIN reached the Hydrogen client as an empty storeDomain, which throws 'storeDomain is required and must be non-empty'. Fall back to the tokenless mock.shop store, only send the public token alongside a configured domain, and have the editor's Shopify plugin read the same resolved config. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f71d73d7c0
commit
6104838684
@@ -1,8 +1,15 @@
|
||||
export const SHOPIFY_STORE_DOMAIN = process.env.NEXT_PUBLIC_SHOPIFY_DOMAIN;
|
||||
const CONFIGURED_STORE_DOMAIN = process.env.NEXT_PUBLIC_SHOPIFY_DOMAIN?.trim();
|
||||
|
||||
// Never assign a private token to this public environment variable.
|
||||
export const SHOPIFY_PUBLIC_ACCESS_TOKEN =
|
||||
process.env.NEXT_PUBLIC_SHOPIFY_PUBLIC_ACCESS_TOKEN;
|
||||
// Falls back to the tokenless mock.shop demo store when the variable is unset
|
||||
// or blank — the Storefront client rejects an empty domain.
|
||||
export const SHOPIFY_STORE_DOMAIN = CONFIGURED_STORE_DOMAIN || 'mock.shop';
|
||||
|
||||
// Never assign a private token to this public environment variable. Only used
|
||||
// alongside a configured domain: a token belongs to one store, so it is never
|
||||
// sent to the mock.shop fallback.
|
||||
export const SHOPIFY_PUBLIC_ACCESS_TOKEN = CONFIGURED_STORE_DOMAIN
|
||||
? process.env.NEXT_PUBLIC_SHOPIFY_PUBLIC_ACCESS_TOKEN?.trim() || undefined
|
||||
: undefined;
|
||||
|
||||
export const SHOPIFY_API_VERSION =
|
||||
process.env.NEXT_PUBLIC_SHOPIFY_API_VERSION || '2026-07';
|
||||
|
||||
Reference in New Issue
Block a user