Skip to content

Fix Cloudflare tunnel shutdown errors on Windows (5.0) - #9066

Merged
isaacroldan merged 2 commits into
stable/5.0from
codex/fix-windows-tunnel-shutdown-5.0
Nov 4, 2026
Merged

isaacroldan merged 2 commits into
stable/5.0from
codex/fix-windows-tunnel-shutdown-5.0

Conversation

@isaacroldan

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Stopping a working app dev session on Windows can report that the Cloudflare tunnel crashed. The final process-tree cleanup kills the tunnel without marking its exit as an expected stop.

WHAT is this pull request doing?

Apply the same fix as #9065 to stable/5.0: stop the managed tunnel through the dev session's abort signal before process-tree cleanup, and release it when preparation, process setup, or the session fails. Keep reporting unexpected tunnel failures.

Include a patch changeset for @shopify/app in this stable PR only.

How to manually test your changes?

  1. On Windows, run pnpm shopify app dev --path <app-directory> from this checkout with a linked app.
  2. Wait for the tunnel to connect and confirm that the app preview works.
  3. Press q. Confirm that the session stops without the Cloudflare "process crashed after stablishing a connection" error.
  4. Start the session again and stop it with Ctrl+C. Confirm the same result.

Validation

  • Five new lifecycle regression cases fail before the fix and pass after it.
  • 86 related tests pass, including the subprocess shutdown tests.
  • App type check, changed-file ESLint, and Prettier checks pass.
  • Live Windows validation is not yet complete.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the patch bump type and added a changeset

@github-actions github-actions Bot added the Area: @shopify/app @shopify/app package issues label Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

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/common/json-output-schema.d.ts
@@ -1,5 +1,4 @@
 import { z } from 'zod';
-export declare const jsonOutputStoreDomainSchema: z.ZodString;
 /** UTC instants in CLI-owned JSON use whole seconds and the Z timezone marker. */
 export declare const jsonOutputTimestampSchema: z.ZodString;
 /**
packages/cli-kit/dist/private/node/conf-store.d.ts
@@ -73,7 +73,7 @@ export declare function cacheStore(key: ExportedKey, value: string, config?: Loc
 /**
  * Fetch from cache if already populated, otherwise return undefined.
  * @param key - The key to use for the cache.
- * @returns The cache element.
+ * @returns The chache element.
  */
 export declare function cacheRetrieve(key: ExportedKey, config?: LocalStorage<ConfSchema>): CacheValue<string> | undefined;
 export declare function cacheClear(config?: LocalStorage<ConfSchema>): void;
packages/cli-kit/dist/private/node/constants.d.ts
@@ -8,7 +8,6 @@ export declare const environmentVariables: {
     env: string;
     noAnalytics: string;
     optOutInstrumentation: string;
-    doNotTrack: string;
     serviceAccountToken: string;
     appAutomationToken: string;
     partnersToken: string;
packages/cli-kit/dist/public/node/base-command.d.ts
@@ -13,7 +13,7 @@ export interface NonTTYFlagRequirement {
 declare abstract class BaseCommand extends Command {
     static baseFlags: FlagInput<{}>;
     static descriptionWithMarkdown?: string;
-    static jsonOutputSchema?: JsonOutputSchema;
+    static get jsonOutputSchema(): JsonOutputSchema | undefined;
     static get requiresSyncAnalytics(): boolean;
     static nonTTYFlagRequirements(_flags: FlagOutput): NonTTYFlagRequirement[];
     static descriptionForHelp(): string | undefined;
packages/cli-kit/dist/public/node/json-output-schema.d.ts
@@ -1,6 +1,6 @@
 import { zodToJsonSchema } from 'zod-to-json-schema';
 import type { ZodTypeAny, z } from 'zod';
-export { formatJsonOutputTimestamp, jsonOutputTimestampSchema, jsonOutputStoreDomainSchema, } from '../common/json-output-schema.js';
+export { formatJsonOutputTimestamp, jsonOutputTimestampSchema } from '../common/json-output-schema.js';
 interface JsonOutputSchemaDefinition<TSchema extends ZodTypeAny = ZodTypeAny> {
     readonly name: string;
     readonly schema: TSchema;
packages/cli-kit/dist/public/node/notifications-system.d.ts
@@ -172,7 +172,7 @@ export declare function showNotificationsIfNeeded(currentSurfaces?: string[], en
  */
 export declare function getNotifications(): Promise<Notifications>;
 /**
- * Fetch notifications from the CDN and cache them.
+ * Fetch notifications from the CDN and chache them.
  *
  * @returns A string with the notifications.
  */
packages/cli-kit/dist/public/node/context/local.d.ts
@@ -52,7 +52,7 @@ export declare function isUnitTest(env?: NodeJS.ProcessEnv): boolean;
  * Returns true if reporting analytics is enabled.
  *
  * @param env - The environment variables from the environment of the current process.
- * @returns True unless SHOPIFY_CLI_NO_ANALYTICS, OPT_OUT_INSTRUMENTATION or DO_NOT_TRACK is truthy, or debug mode is enabled.
+ * @returns True unless SHOPIFY_CLI_NO_ANALYTICS or OPT_OUT_INSTRUMENTATION is truthy, or debug mode is enabled.
  */
 export declare function analyticsDisabled(env?: NodeJS.ProcessEnv): boolean;
 /**
packages/cli-kit/dist/public/node/graphiql/server.d.ts
@@ -27,14 +27,13 @@ export declare function resolveGraphiQLKey(providedKey: string | undefined, apiS
  * - `getToken` may return a cached token; the proxy calls it for every request.
  * - `refreshToken` (optional) is invoked when the upstream Admin API returns 401.
  * When omitted, the proxy falls back to calling `getToken` again on 401.
- * - Both operations receive a cancellation signal to pass to token requests.
  *
  * Implementations must throw `TokenRefreshError` (or any thrown error) when the
  * token cannot be obtained; the proxy renders the unauthorized template in that case.
  */
 export interface TokenProvider {
-    getToken: (signal?: AbortSignal) => Promise<string>;
-    refreshToken?: (signal?: AbortSignal) => Promise<string>;
+    getToken: () => Promise<string>;
+    refreshToken?: () => Promise<string>;
 }
 /**
  * Optional app-specific context, used to render the app pill and scopes note in the
@@ -66,10 +65,6 @@ export interface SetupGraphiQLServerOptions {
      * interactive UI.
      */
     protectMutations?: boolean;
-    /** Called for request failures that leave the server available for subsequent requests. */
-    onRequestError?: (message: string) => void;
-    /** Routes diagnostics through command events and leaves readiness output to the session. */
-    json?: boolean;
 }
 export declare const MUTATIONS_BLOCKED_MESSAGE = "Mutations are disabled. Re-run with --allow-mutations to enable mutations.";
 /**
packages/cli-kit/dist/public/node/graphiql/session.d.ts
@@ -22,7 +22,6 @@ export interface RunGraphiQLSessionOptions {
     additionalReadyMessages?: OutputMessage[];
     abortSignal?: AbortSignal;
     stdout?: Writable;
-    outputFormat?: 'text' | 'json';
 }
 /**
  * Generates a random key suitable for authenticating a single local GraphiQL session.

@isaacroldan

Copy link
Copy Markdown
Contributor Author

/snapit

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🫰✨ Thanks @isaacroldan! Your snapshot has been published to npm.

Built from aee032cdec63cd2c9af64f3e27f99d5c80bdae30. Workflow run.

Test the snapshot by installing your package globally:

pnpm i -g --@shopify:registry=https://registry.npmjs.org @shopify/[email protected]

Caution

After installing, validate the version by running shopify version in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

@isaacroldan
isaacroldan marked this pull request as ready for review November 4, 2026 11:47
@isaacroldan
isaacroldan requested a review from a team as a code owner November 4, 2026 11:47
@isaacroldan
isaacroldan merged commit 50cc64a into stable/5.0 Nov 4, 2026
26 of 27 checks passed
@isaacroldan
isaacroldan deleted the codex/fix-windows-tunnel-shutdown-5.0 branch November 4, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: @shopify/app @shopify/app package issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants