Skip to content

Rewrite dev store APIs in local dev for app preview#6808

Open
dmerand wants to merge 2 commits intomainfrom
dlm-local-dev-testing
Open

Rewrite dev store APIs in local dev for app preview#6808
dmerand wants to merge 2 commits intomainfrom
dlm-local-dev-testing

Conversation

@dmerand
Copy link
Contributor

@dmerand dmerand commented Feb 2, 2026

WHY are these changes introduced?

Recent changes to normalize store FQDNs in local development mode (commits ce04cc6 and 86748ac from #6735) introduced a transformation that replaces .my.shop.dev with .dev-api.shop.dev. This breaks shopify app dev in local environments because:

  1. The BusinessPlatform API cannot find stores with the .dev-api.shop.dev domain
  2. Preview URLs are generated with the wrong domain pattern for local dev stores

WHAT is this pull request doing?

This PR makes two changes to fix local development:

1. Reverts the .dev-api.shop.dev transformation (fqdn.ts)

  • Removes the automatic replacement of .my.shop.dev.dev-api.shop.dev
  • This allows the CLI to query for stores using their actual registered domain
  • Store lookups in BusinessPlatform API now succeed for local dev stores

2. Transforms preview URLs for local dev (app-url.ts)

  • In local mode, transforms app preview URLs from {store}.my.shop.dev/admin/... to admin.shop.dev/store/{store}/admin/...
  • This matches the URL pattern used by local development servers
  • Applied to both web and mobile app URLs

How to test your changes?

Prerequisites:

  • Local dev environment with SHOPIFY_SERVICE_ENV=local
  • A dev store accessible in your organization (e.g., dev-store.my.shop.dev)

Testing:

SHOPIFY_SERVICE_ENV=local \
shopify app dev --path=<your-app-path>

Expected behavior:

  • ✅ CLI successfully finds your dev store (no "Could not find store for domain" error)
  • ✅ Preview URLs use the admin.shop.dev/store/{store-name}/admin/... pattern
  • ✅ Dev server starts successfully

Before these changes:

  • ❌ Error: "Could not find store for domain dev-store.dev-api.shop.dev"
  • ❌ Store lookup fails because BusinessPlatform doesn't recognize .dev-api.shop.dev

Measuring impact

  • n/a - this is a bug-fix for local development environment

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows) - changes only affect local dev with SHOPIFY_SERVICE_ENV=local
  • I've considered possible documentation changes - no user-facing docs needed (internal local dev)

Copy link
Contributor Author

dmerand commented Feb 2, 2026

@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2026

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
79.67% (+0.44% 🔼)
14457/18147
🟡 Branches
73.99% (+0.88% 🔼)
7175/9697
🟡 Functions
79.79% (+0.42% 🔼)
3688/4622
🟢 Lines
80.03% (+0.45% 🔼)
13669/17080
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / admin-as-app.ts
100% 100% 100% 100%
🟢
... / metafield_definitions.ts
100% 100% 100% 100%
🟢
... / metaobject_definitions.ts
100% 100% 100% 100%
🟢
... / bulk-operation-cancel.ts
100% 100% 100% 100%
🟢
... / bulk-operation-run-mutation.ts
100% 100% 100% 100%
🟢
... / bulk-operation-run-query.ts
100% 100% 100% 100%
🟢
... / get-bulk-operation-by-id.ts
100% 100% 100% 100%
🟢
... / list-bulk-operations.ts
100% 100% 100% 100%
🟢
... / staged-uploads-create.ts
100% 100% 100% 100%
🟢
... / fetch_store_by_domain.ts
100% 100% 100% 100%
🟢
... / organization_exp_flags.ts
100% 100% 100% 100%
🔴
... / import-custom-data-definitions.ts
0% 100% 0% 0%
🔴
... / cancel.ts
0% 100% 0% 0%
🔴
... / execute.ts
0% 0% 0% 0%
🔴
... / status.ts
0% 0% 0% 0%
🔴
... / pull.ts
0% 100% 0% 0%
🟡
... / execute-operation.ts
75.68% 50% 100% 75.68%
🔴
... / pull.ts
0% 0% 0% 0%
🟢
... / bulk-operation-status.ts
96.55% 92.11% 100% 100%
🟢
... / cancel-bulk-operation.ts
100% 100% 100% 100%
🟢
... / constants.ts
100% 100% 100% 100%
🟢
... / download-bulk-operation-results.ts
100% 100% 100% 100%
🟢
... / execute-bulk-operation.ts
87.14% 83.67% 100% 88.41%
🟢
... / format-bulk-operation-status.ts
100% 100% 100% 100%
🟢
... / run-mutation.ts
100% 100% 100% 100%
🟢
... / run-query.ts
100% 100% 100% 100%
🟡
... / stage-file.ts
73.53% 62.5% 85.71% 72.73%
🟢
... / watch-bulk-operation.ts
100% 94.74% 100% 100%
🟢
... / utilities.ts
100% 100% 100% 100%
🟢
... / declarative-definitions.ts
98.54% 93.18% 100% 98.51%
🟢
... / common.ts
97.62% 95% 100% 97.06%
🟢
... / execute-command-helpers.ts
100% 100% 100% 100%
🟢
... / file-formatter.ts
100% 100% 100% 100%
🔴
... / promiseWithResolvers.ts
33.33% 50% 50% 33.33%
🟢
... / theme-listing.ts
100% 100% 100% 100%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🔴
... / execute.ts
0%
0% (-100% 🔻)
0% 0%
🟢
... / loader.ts
94.06% (+0.2% 🔼)
86.41% (-0.42% 🔻)
97.17% (+0.11% 🔼)
94.85% (+0.18% 🔼)
🟢
... / extension-instance.ts
84.8% (+0.23% 🔼)
77.6% (-0.91% 🔻)
92.06% (+0.13% 🔼)
85.11% (+0.24% 🔼)
🟡
... / specification.ts
69.64% (+0.55% 🔼)
75.61% (+2.44% 🔼)
76.47% (-1.31% 🔻)
69.39% (+0.64% 🔼)
🟢
... / ui_extension.ts
88.61% (-6.22% 🔻)
78.57% (-2.68% 🔻)
85.19% (-14.81% 🔻)
90.79% (-5.67% 🔻)
🟢
... / store-context.ts
100%
82.35% (-0.98% 🔻)
100% 100%
🟢
... / Logs.tsx
90%
90.91% (-5.97% 🔻)
100% 90%
🟢
... / fetch.ts
84.21% (+0.88% 🔼)
82.35% (-0.98% 🔻)
75%
85.29% (+1.42% 🔼)
🟢
... / app-event-watcher-handler.ts
86.36% (-4.11% 🔻)
75% 86.67%
85.71% (-5.19% 🔻)
🟡
... / middlewares.ts
77.33% (-0.87% 🔻)
75%
68.42% (-1.58% 🔻)
76.39% (-0.94% 🔻)
🔴
... / server.ts
1.23% (-0.02% 🔻)
0% 0%
1.3% (-0.02% 🔻)
🟢
... / setup-dev-processes.ts
93.62% (+0.14% 🔼)
66.67% (-4.76% 🔻)
90%
92.86% (+0.17% 🔼)
🟢
... / bundle.ts
93.22%
63.33% (-3.33% 🔻)
94.12% (+5.88% 🔼)
96.3%
🟢
... / developer-platform-client.ts
84.62% (-1.5% 🔻)
71.43% (+0.84% 🔼)
81.82% (+1.82% 🔼)
93.75% (+0.42% 🔼)
🔴
... / http-reverse-proxy.ts
58.97% (-4.91% 🔻)
37.04% (-2.96% 🔻)
58.33% (-5.3% 🔻)
59.46% (-5.25% 🔻)
🟢
... / api.ts
87.07% (-0.43% 🔻)
76.71% (-0.1% 🔻)
100%
86.49% (-0.43% 🔻)
🟢
... / device-authorization.ts
88.24% (-0.83% 🔻)
76.47% (-2.94% 🔻)
100%
88.24% (-0.83% 🔻)
🟢
... / SingleTask.tsx
84.21% (-15.79% 🔻)
50% (-50% 🔻)
80% (-20% 🔻)
84.21% (-15.79% 🔻)
🔴
... / environment.ts
35% (-5% 🔻)
41.18%
40% (-10% 🔻)
36.84% (-5.26% 🔻)
🔴
... / ui.tsx
50.82% (-0.79% 🔻)
42.86% (-5.53% 🔻)
54.55% (+1.42% 🔼)
50% (-0.82% 🔻)
🟢
... / fqdn.ts
93.62% (-1.94% 🔻)
88% (-3.3% 🔻)
100%
93.62% (-1.94% 🔻)
🟢
... / console.ts
81.82% (+15.15% 🔼)
75% (-25% 🔻)
100% (+33.33% 🔼)
81.82% (+15.15% 🔼)
🟢
... / init.ts
88% (-0.89% 🔻)
71.43% (+4.76% 🔼)
86.67% (+4.85% 🔼)
88% (-0.89% 🔻)
🟢
... / storefront-renderer.ts
90.2% (-0.54% 🔻)
78.95%
81.82% (-1.52% 🔻)
90.2% (-0.54% 🔻)
🟡
... / theme-polling.ts
67.57% (-0.49% 🔻)
68.75% 78.57%
66.18% (-1.47% 🔻)

Test suite run success

3718 tests passing in 1438 suites.

Report generated by 🧪jest coverage report action from ba17bbd

@dmerand dmerand force-pushed the dlm-local-dev-testing branch from c433e16 to b0cb12d Compare February 2, 2026 19:38
@dmerand dmerand changed the title Revert FQDN change for dev-api Make dev store APIs work in local dev Feb 2, 2026
@dmerand dmerand changed the title Make dev store APIs work in local dev Rewrite dev store APIs in local dev for app preview Feb 2, 2026
@dmerand dmerand marked this pull request as ready for review February 2, 2026 20:02
@dmerand dmerand requested a review from a team as a code owner February 2, 2026 20:02
@dmerand dmerand marked this pull request as draft February 2, 2026 20:02
Copy link
Contributor

@gonzaloriestra gonzaloriestra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dmerand dmerand marked this pull request as ready for review February 4, 2026 22:56
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run pnpm changeset add to track your changes and include them in the next release CHANGELOG.

Caution

DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release.

@dmerand dmerand force-pushed the dlm-local-dev-testing branch from b0cb12d to ba17bbd Compare February 4, 2026 22:58
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/context/fqdn.d.ts
@@ -50,4 +50,12 @@ export declare function identityFqdn(): Promise<string>;
  * @param store - Store name.
  * @returns Normalized store name.
  */
-export declare function normalizeStoreFqdn(store: string): string;
\ No newline at end of file
+export declare function normalizeStoreFqdn(store: string): string;
+/**
+ * Convert a store FQDN to the admin URL pattern for local development.
+ * In local mode, transforms \{store\}.my.shop.dev to admin.shop.dev/store/\{store\}.
+ *
+ * @param storeFqdn - Normalized store FQDN.
+ * @returns Store admin URL base (without protocol or path).
+ */
+export declare function storeAdminUrl(storeFqdn: string): string;
\ No newline at end of file

@dmerand dmerand enabled auto-merge February 5, 2026 00:31
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.

2 participants