Repository navigation
fix(hydrogen): pass relative schema paths to gql check on Windows - #4367
Open
Peerapatfc wants to merge 2 commits into
Open
Peerapatfc wants to merge 2 commits into
Peerapatfc wants to merge 2 commits into
Conversation
gql.tada runs new URL(schema) before treating a schema as a file. On Windows an absolute path like C:\x\y.json parses as a URL (protocol c:), so the schema was fetched over the network and gql check failed. Pass a path relative to the temporary tsconfig instead, and add unit tests that simulate win32 paths.
Peerapatfc
force-pushed
the
fix/gql-check-windows-schema-path
branch
from
November 12, 2026 06:45
60557bc to
475bf39
Compare
Author
|
I have signed the CLA! |
1 similar comment
Author
|
I have signed the CLA! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4359
TL;DR:
hydrogen gql checkfails on Windows with[Network] fetch failedbecause the Hydrogen schema paths are passed to gql.tada as absolute paths, and gql.tada treats a Windows drive-letter path as a URL.Before
gql checkpassedjoin(packageRoot, "dist")(absolute) tocreateGraphQLPluginConfig. gql.tada runsnew URL(schema)before deciding a schema is a file. On Windowsnew URL("C:\\x\\y.json")succeeds (protocolc:), so the schema is fetched over the network and the command fails.After
The schema directory is passed relative to the temporary tsconfig. A relative path is not a valid URL, so gql.tada falls back to reading the file.
What this changes
packages/hydrogen/src/cli/gql.ts: adds an exportedgetSchemaDirectory()helper (takes an injectable path API) and uses it to build the schema directory.packages/hydrogen/src/cli/gql.test.ts: expects relative schema paths, and adds tests that simulate Windows paths withpath.win32.Developer impact
Includes a patch changeset for
@shopify/hydrogen. No new public exports or runtime contract changes.Out of scope
file:URL is not an option: gql.tada runsnew URL()first, so it would be fetched rather than read from disk.src/ts-plugin/index.tsalso passes an absoluteSCHEMA_DIRECTORYto the same helper (editor plugin). Not changed here; possible follow-up.Risk
D:, package onC:),path.relativereturns an absolute path and the bug remains. A unit test documents this as a known limitation...\..\x) are not URLs, but I have not confirmed on Windows that gql.tada then reads them from disk.How to Test
On Windows (Node 24+):
pnpm install && pnpm build:pkgs.tsconfig.json, link the built@shopify/hydrogenpackage.npx hydrogen gql check.No problems foundinstead of[Network] fetch failed.Verification so far: unit and integration tests pass on Linux (Node 22). Not yet verified on Windows.