Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(graphql) generate:schema fails on windows due to url protocol c: #9309

Closed
6TELOIV opened this issue Nov 18, 2024 · 4 comments · Fixed by #9311
Closed

(graphql) generate:schema fails on windows due to url protocol c: #9309

6TELOIV opened this issue Nov 18, 2024 · 4 comments · Fixed by #9311
Assignees

Comments

@6TELOIV
Copy link
Contributor

6TELOIV commented Nov 18, 2024

Describe the Bug

Generating a graphql schema on windows with payload-graphql generate:schema fails with:
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

Link to the code that reproduces this issue

https://github.com/6TELOIV/graphql-schema-windows-url-scheme

Reproduction Steps

This error ONLY effects windows, and is due to c: being confused for a URL scheme (i.e http:, file:, or node:)

  1. Clone the repro repo
  2. Run pnpm i (or your favorite pacman)
  3. Run pnpm payload-graphql generate:schema (or your favorite pacman)
  4. Observe the error

Which area(s) are affected? (Select all that apply)

area: core

Environment Info

Payload: 3.0.0-beta.134
Next: 15.0.0
Node: 2.11.0
@6TELOIV 6TELOIV added status: needs-triage Possible bug which hasn't been reproduced yet v3 validate-reproduction labels Nov 18, 2024
@denolfe denolfe removed the v3 label Nov 19, 2024
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Nov 20, 2024
Copy link
Contributor

This issue has been marked as stale due to lack of activity.

To keep this issue open, please indicate that it is still relevant in a comment below.

@github-actions github-actions bot added the stale label Dec 14, 2024
Copy link
Contributor

This issue was automatically closed due to lack of activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 21, 2024
@denolfe denolfe reopened this Dec 21, 2024
@github-actions github-actions bot added the status: needs-triage Possible bug which hasn't been reproduced yet label Dec 21, 2024
DanRibbens pushed a commit that referenced this issue Dec 30, 2024
### What?

On windows, the `payload-graphql generate:schema` command fails.

### Why?

Because the config it's trying to load is `c:\path\to\config.js`, which
node interprets as `\path\to\config.js` on the `c:` protocol.

### How?

By changing it to use a file URL, as in `file:\\\c:\path\to\config.js`.
The change is the same as what the main `payload` cli does:
https://github.com/payloadcms/payload/blob/main/packages/payload/src/bin/index.ts#L54

Fixes #9309

Co-authored-by: Violet Rosenzweig <[email protected]>
@github-actions github-actions bot removed status: needs-triage Possible bug which hasn't been reproduced yet stale labels Dec 30, 2024
Copy link
Contributor

github-actions bot commented Jan 1, 2025

This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 1, 2025
Copy link
Contributor

github-actions bot commented Jan 2, 2025

🚀 This is included in version v3.13.0

@github-actions github-actions bot unlocked this conversation Jan 2, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jan 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants