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

problem handling file path of graphql config file in Windows #2066

Closed
adielBm opened this issue Nov 28, 2021 · 6 comments · Fixed by #2072
Closed

problem handling file path of graphql config file in Windows #2066

adielBm opened this issue Nov 28, 2021 · 6 comments · Fixed by #2072
Labels
bug lsp-server graphql-language-service-server

Comments

@adielBm
Copy link

adielBm commented Nov 28, 2021

Actual Behavior

When doing the "Execute Query": Get an empty tab. (The right tab in the image)

When saving graphql config file: Problem handling file path.

(node:2880) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/c%3A/Users/adiel/Desktop/raz-ecommerce/raz-ecommerce-front/.graphqlrc.yml'

image

Expected Behavior

That everything will work properly. It will be possible to execute queries

Steps to Reproduce the Problem Or Description

Specifications

  • GraphQL for VSCode Extension Version: v0.3.26
  • VSCode Version: 1.62.3
  • OS Name: Windows 10
  • OS Version: Windows_NT x64 10.0.19042
  • graphql config filename and format example: .graphqlrc.yml
schema: 'schema.graphql'
extensions:
  endpoints:
    default:
      url: http://localhost:1337/graphql

Logs Of TS Server || GraphQL Language Service

When saving graphql config file

28.11.2021, 14:23:03 [3] (pid: 2880) graphql-language-service-usage-logs: updating graphql config
(node:2880) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/c%3A/Users/adiel/Desktop/raz-ecommerce/raz-ecommerce-front/.graphqlrc.yml'
    at Object.openSync (fs.js:476:3)
    at Object.func [as openSync] (electron/js2c/asar_bundle.js:5:1846)
    at Object.readFileSync (fs.js:377:35)
    at Object.e.readFileSync (electron/js2c/asar_bundle.js:5:8872)
    at c:\Users\adiel\.vscode\extensions\graphql.vscode-graphql-0.3.26\out\server\server.js:107571:31
    at Array.map (<anonymous>)
    at MessageProcessor.handleWatchedFilesChangedNotification (c:\Users\adiel\.vscode\extensions\graphql.vscode-graphql-0.3.26\out\server\server.js:107553:43)
    at c:\Users\adiel\.vscode\extensions\graphql.vscode-graphql-0.3.26\out\server\server.js:115845:126
    at handleNotification (c:\Users\adiel\.vscode\extensions\graphql.vscode-graphql-0.3.26\out\server\server.js:112043:17)
    at processMessageQueue (c:\Users\adiel\.vscode\extensions\graphql.vscode-graphql-0.3.26\out\server\server.js:111817:13)
(node:2880) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 30)

When doing the "Execute Query":

NetworkHelper: operation: query
NetworkHelper: endpoint: http://localhost:1337/graphql
@adielBm adielBm changed the title Problem handling file path of graphql config file in Windows problem handling file path of graphql config file in Windows Nov 28, 2021
@acao
Copy link
Member

acao commented Nov 28, 2021

Yikes! Looks like some paths have been urlencoded. Because it concerns loading the graphql config file itself, I think this may be related to our upgrade of graphql-config to v4

@acao acao transferred this issue from graphql/vscode-graphql Nov 28, 2021
@adielBm
Copy link
Author

adielBm commented Nov 28, 2021

Sorry, but it's not related to the version of graphql-config,
My version is updated: graphql-config 4.1.0.

This is the path of the project folder:
C:\Users\adiel\Desktop\raz-ecommerce\raz-ecommerce-front

And it looks like it's looking for this file:: (And because of this it does not find the config file)
/c%3A/Users/adiel/Desktop/raz-ecommerce/raz-ecommerce-front/.graphqlrc.yml

thanks @acao

@acao
Copy link
Member

acao commented Nov 28, 2021

Ohh i see, you see this when saving the config files that makes sense. I’ll look into it some more. The major bugfix recently involved reverting some changes to how we parse file uris into system paths and as i guess the revert is url encoding them again! I have a windows machine i can try this out on tomorrow morning. Thanks for reporting this!

@acao
Copy link
Member

acao commented Nov 28, 2021

I think vscode-uri would be the appropriate uri parser to switch to

@acao acao added bug known bugs lsp-server graphql-language-service-server labels Nov 28, 2021
@acao
Copy link
Member

acao commented Nov 28, 2021

here’s a stackoverflow example. To look for the offending lines, you can just look for new Uri(uri).basename, in cases where a vscode file URI needs to be converted to a system path that can be used by something like fs.readFile etc

https://stackoverflow.com/a/55660674

@acao
Copy link
Member

acao commented Nov 30, 2021

I think #2072 will take care of this for good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug lsp-server graphql-language-service-server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants