Skip to content

relay-compiler not working on Windows beginning version 21.0.0: Relay LSP Logs state unable to convert URI to file path ("/c%3A/" instead of "/c:/") #5347

Description

Summary

The relay-compiler does not work on Windows beginning version 21.0.0.
Can't be reproduced in version 20.0.0.
When setting up a brand new package.json with a basic relay.config.js setup, the relay-compiler can't throws errors on

  • finding the schema path configured in relay.config.js due to an formatting error in the path.
  • providing info (intellisense trigger in vs code for example) on any graphql-file.

The error is:

[Error - 7:43:45 AM] Request textDocument/hover failed.
  Message: Unable to convert URI to file path: Uri(Uri { scheme: Some("file"), authority: Some(Authority { userinfo: None, host: Host { text: "", data: RegName("") }, port: None }), path: "/c%3A/Development/repo-relay-compiler-bug/src/something.graphql", query: None, fragment: None })
  Code: -32001 

Reproduction

package.json devDependencies

"devDependencies": {
  "relay-compiler": "21.0.1"
}

relay.config.js

const path = require("node:path");

const config = /** @type {const} */ ({
  src: path.resolve(__dirname, "./src"),
  language: "typescript",
  schema: path.resolve(__dirname, "./schema.graphql"),
  excludes: ["**/node_modules/**", "**/__generated__/**", "**/dist/**", "**/.yarn/**"],
  eagerEsModules: true,
  noFutureProofEnums: true,
  typescriptExcludeUndefinedFromNullableUnion: true,
});

module.exports = config;
  1. yarn
  2. Create any *.graphql file in src/ folder
  3. The Relay LSP Logs output shows the error
[Error - 7:43:45 AM] Request textDocument/hover failed.
  Message: Unable to convert URI to file path: Uri(Uri { scheme: Some("file"), authority: Some(Authority { userinfo: None, host: Host { text: "", data: RegName("") }, port: None }), path: "/c%3A/Development/repo-relay-compiler-bug/src/something.graphql", query: None, fragment: None })
  Code: -32001 

Environment

  • relay-compiler 21.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions