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

fix(graphql): Change config from raw path to file: url #9311

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

6TELOIV
Copy link

@6TELOIV 6TELOIV commented Nov 18, 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

@6TELOIV
Copy link
Author

6TELOIV commented Nov 18, 2024

Not sure how to write a regression test for this, as it's platform specific.

Could involve modifying findConfig instead to do this change (i.e, call pathToFileURL before returning) as the findConfig function only seems to be called in the 2 CLIs (payload-graphql and payload), and then modifying those usages to use the path directly. Or, maybe introduce a new function findConfigFileURL and have it wrap the findConfig function. With either of those changes, then this could have an integration test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(graphql) generate:schema fails on windows due to url protocol c:
2 participants