From d22ad6186941971354390016e55b53df17741554 Mon Sep 17 00:00:00 2001 From: Philippe Collin Date: Wed, 17 Jun 2026 12:12:56 -0400 Subject: [PATCH] Only treat .myshopify.io as a normalized store FQDN suffix Assisted-By: devx/6a08152b-0dac-4994-ac1a-d0471a9ed4a9 --- .changeset/normalize-store-fqdn-suffix.md | 5 +++ .../src/public/node/context/fqdn.test.ts | 33 +++++++++++++++++++ .../cli-kit/src/public/node/context/fqdn.ts | 2 +- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .changeset/normalize-store-fqdn-suffix.md diff --git a/.changeset/normalize-store-fqdn-suffix.md b/.changeset/normalize-store-fqdn-suffix.md new file mode 100644 index 00000000000..2bb271fb98e --- /dev/null +++ b/.changeset/normalize-store-fqdn-suffix.md @@ -0,0 +1,5 @@ +--- +'@shopify/cli-kit': patch +--- + +Only treat `.myshopify.io` (not any `shopify.io` suffix) as an already-normalized store FQDN diff --git a/packages/cli-kit/src/public/node/context/fqdn.test.ts b/packages/cli-kit/src/public/node/context/fqdn.test.ts index 72f51b35dda..77969053eaf 100644 --- a/packages/cli-kit/src/public/node/context/fqdn.test.ts +++ b/packages/cli-kit/src/public/node/context/fqdn.test.ts @@ -217,4 +217,37 @@ describe('normalizeStore', () => { // Then expect(got).toEqual('example.myshopify.com') }) + + test('preserves local dev store names ending in .myshopify.io', async () => { + // Given + vi.mocked(serviceEnvironment).mockReturnValue(Environment.Local) + + // When + const got = normalizeStoreFqdn('example.myshopify.io') + + // Then + expect(got).toEqual('example.myshopify.io') + }) + + test('does not treat other domains ending in shopify.io as already normalized', async () => { + // Given + vi.mocked(serviceEnvironment).mockReturnValue(Environment.Production) + + // When + const got = normalizeStoreFqdn('exampleshopify.io') + + // Then + expect(got).toEqual('exampleshopify.io.myshopify.com') + }) + + test('does not treat nested domains ending in shopify.io as already normalized', async () => { + // Given + vi.mocked(serviceEnvironment).mockReturnValue(Environment.Production) + + // When + const got = normalizeStoreFqdn('example.exampleshopify.io') + + // Then + expect(got).toEqual('example.exampleshopify.io.myshopify.com') + }) }) diff --git a/packages/cli-kit/src/public/node/context/fqdn.ts b/packages/cli-kit/src/public/node/context/fqdn.ts index 85e6036bb1f..4bbe1592cf4 100644 --- a/packages/cli-kit/src/public/node/context/fqdn.ts +++ b/packages/cli-kit/src/public/node/context/fqdn.ts @@ -139,7 +139,7 @@ export function normalizeStoreFqdn(store: string): string { } } const containDomain = (storeFqdn: string) => - storeFqdn.endsWith('.myshopify.com') || storeFqdn.endsWith('shopify.io') || storeFqdn.endsWith('.shop.dev') + storeFqdn.endsWith('.myshopify.com') || storeFqdn.endsWith('.myshopify.io') || storeFqdn.endsWith('.shop.dev') return containDomain(storeFqdn) ? storeFqdn : addDomain(storeFqdn) }