`gql check` and the TS plugin still fail on Windows when schema paths are absolute

Open
#4,371 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

@JooaoGui is already working on this.

Since Nov 23, 2026.

  • #4421 by @JooaoGui — open

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
node.js, typescript, vscode
Domain
devtools, testing

Research direction

Start with src/ts-plugin/index.ts, the schema loading helper in @gql.tada/internal 1.0.9, and graphqlsp 1.15.4; then review #4359 and #4367. Reproduce absolute-path loading on Windows, including a project and package on different drives, and verify how backslash relative paths are handled. Done means both gql check and the editor plugin load schemas from disk on Windows, with VS Code testing and no regressions on other platforms.

Written by the indexing model from the issue text.

Description

Follow-up to #4359 and the draft fix in #4367.

Status: neither case below has been reproduced on Windows yet. Both come from reading the code in @gql.tada/internal 1.0.9 and @0no-co/graphqlsp 1.15.4, plus Node URL behavior checks that are platform independent.

Background

gql.tada's getURLConfig runs new URL(origin) first. If that parses, the schema is loaded with loadFromURL (a network fetch). Only if it throws is the string treated as a file path and read via resolve(rootPath, origin).

On Windows, new URL("C:\\x\\y.json") parses (protocol c:), so an absolute drive-letter schema path is fetched instead of read from disk, which is the [Network] fetch failed in #4359. A file: URL is not a workaround: it parses as a URL too and goes to fetch.

#4367 fixes hydrogen gql check by passing the schema directory relative to the temporary tsconfig. Two cases remain.

1. Project and Hydrogen package on different drives

path.relative cannot produce a relative path across drives, so it returns the absolute path (for example path.win32.relative('D:\\proj\\.t', 'C:\\pkg\\dist') returns C:\pkg\dist). That parses as a URL, so hydrogen gql check still fails for this layout. A unit test in #4367 documents this as a known limitation.

Possible fix: copy the two schema files (about 1.4 MB and 1.7 MB) next to the temporary tsconfig and reference them by relative name, cleaned up with the existing temporary-file cleanup.

2. Editor TypeScript plugin

src/ts-plugin/index.ts passes an absolute SCHEMA_DIRECTORY = resolve(__dirname, "..") to the same helper, loaded through graphqlsp, which applies the same URL check. It very likely fails the same way on Windows, probably only logging Failed to load schema in the editor.

Things to be careful about:

  • graphqlsp computes rootPath asynchronously from resolveTypeScriptRootDir(project.getProjectName()), so a relative path needs the right base directory. A wrong base would break every OS.
  • The change should apply only when the absolute path would parse as a URL, to leave POSIX behavior untouched.
  • It needs testing in VS Code on Windows.

Needed

  • Reproduction of both cases on Windows (including a cross-drive setup).
  • Confirmation from #4359 on whether backslash relative paths are read from disk by gql.tada, which affects the approach for both.
Dominant language
TypeScript
Stars
2.2k
Forks
466
Avg merge
3d 18h
Merged PRs (30d)
59

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Shopify/hydrogen

All issues in Shopify/hydrogen

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.