`hydrogen gql check` fails on Windows: absolute schema path is parsed as a URL by gql.tada

Aperta
#4,359 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

@Roshan931 ci sta già lavorando.

Dal 11/11/2026.

  • #4361 di @Roshan931 — aperta
  • #4367 di @Peerapatfc — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
graphql, node.js, typescript

Direzione di ricerca

Start with packages/hydrogen/src/cli/gql.ts, where the issue says the CLI builds the temporary gql.tada config, and trace how it determines the tsconfig path and schema paths. Reproduce the failure on Windows with npx hydrogen gql check; compare the absolute schema path with the working relative path described in the issue. Done means the check validates the bundled schemas on Windows, as it does on Linux and macOS.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Environment

  • Windows 11, Node 26, @shopify/hydrogen 2026.10.2 (2026.10.3 and main have the same code)
  • gql.tada 1.9.2, @gql.tada/internal 1.0.9

Steps

  1. Create or migrate a Hydrogen project on Windows with @shopify/hydrogen 2026.10.x.
  2. Run npx hydrogen gql check.

Actual

⚠ Unexpected Error
Could not check files
┗ CombinedError: [Network] fetch failed

The CLI writes a temporary tsconfig and runs gql.tada check on it.

Expected: the check validates the gql() documents against the bundled schemas, as on Linux and macOS.

Cause: packages/hydrogen/src/cli/gql.ts builds the plugin config with createGraphQLPluginConfig(join(packageRoot, "dist")), so schema is an absolute path such as C:\...\storefront.schema.json. gql.tada's getURLConfig runs new URL(schema) before deciding the schema is a file. On Windows that call succeeds (new URL("C:\dev\x\storefront.schema.json").protocol === "c:"), so the schema is loaded as a remote URL and the fetch fails.

Verified workaround / possible fix: with the same tsconfig but schema set to a path relative to the tsconfig (./node_modules/@shopify/hydrogen/dist/storefront.schema.json), gql.tada check prints "No problems found". Changing only those paths to absolute reproduces the error. So the CLI could pass path.relative(dirname(tsconfigPath), …) with forward slashes; new URL throws on that and gql.tada falls back to reading the file.

Impact: hydrogen gql check, which the Hydrogen skills chain into typecheck, cannot run on Windows. We validate locally with a hand-made tsconfig. That check caught a real error: $discountCodes is [String!]! in this API version.

Lingua principale
TypeScript
Stelle
2.2k
Fork
466
Merge medio
3g 18h
PR unite (30g)
59

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Shopify/hydrogen

Tutte le issue di Shopify/hydrogen

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.