facebook / relay

Relay is a JavaScript framework for building data-driven React applications.
https://relay.dev
MIT License
18.4k stars 1.82k forks source link

Relay LS and Relay Compiler error out #4280

Open ameyms opened 1 year ago

ameyms commented 1 year ago

Firstly, I think I have greatly under estimated the amount of effort Relay team must have put in to unsure infra reliability @ FB. This is because I actually used to work at Facebook and working with Relay was an absolute delight.

PS: Could not find the OG #Thanksbot icon so using a Thanccbot instead! 🙂

image

Now Im in the real world and trying to set this up from scratch. I am super bullish on Relay but I am hitting some snags!

What

Trying to get Relay Compiler and Relay's VSCode plugin to work.

Relay: Restart (via Command Palette)

Produces this output:

$ /home/coder/lwcode/fastglass/ui/node_modules/relay-compiler/linux-x64/relay --watch --output=verbose
pyenv shell 3.9.13
[INFO] querying files to compile...
[ERROR] Watchman error: The watchman server reported an error: "failed to parse query: must use ["suffix", "suffixstring"]", while executing command: QueryRequest(
    "query",
    "/home/coder/lwcode/fastglass/ui",
    QueryRequestCommon {
        glob: None,
        glob_noescape: false,
        glob_includedotfiles: false,
        path: Some(
            [
                RecursivePath(
                    "",
                ),
            ],
        ),
        suffix: None,
        since: None,
        relative_root: None,
        expression: Some(
            All(
                [
                    FileType(
                        Regular,
                    ),
                    Any(
                        [
                            All(
                                [
                                    All(
                                        [
                                            Suffix(
                                                [
                                                    "js",
                                                    "jsx",
                                                    "ts",
                                                    "tsx",
                                                ],
                                            ),
                                            DirName(
                                                DirNameTerm {
                                                    path: "src",
                                                    depth: None,
                                                },
                                            ),
                                        ],
                                    ),
                                    Not(
                                        Any(
                                            [
                                                Match(
                                                    MatchTerm {
                                                        glob: "**/node_modules/**",
                                                        wholename: true,
                                                        include_dot_files: false,
                                                        no_escape: false,
                                                    },
                                                ),
                                                Match(
                                                    MatchTerm {
                                                        glob: "**/__mocks__/**",
                                                        wholename: true,
                                                        include_dot_files: false,
                                                        no_escape: false,
                                                    },
                                                ),
                                                Match(
                                                    MatchTerm {
                                                        glob: "**/__generated__/**",
                                                        wholename: true,
                                                        include_dot_files: false,
                                                        no_escape: false,
                                                    },
                                                ),
                                            ],
                                        ),
                                    ),
                                ],
                            ),
                            Name(
                                NameTerm {
                                    paths: [
                                        "dummy.graphql",
                                    ],
                                    wholename: true,
                                },
                            ),
                        ],
                    ),
                ],
            ),
        ),
        fields: [
            "name",
            "exists",
        ],
        empty_on_fresh_instance: false,
        omit_changed_files: false,
        fail_if_no_saved_state: false,
        case_sensitive: false,
        sync_timeout: Default,
        settle_period: None,
        settle_timeout: None,
        dedup_results: false,
        lock_timeout: None,
        request_id: None,
        always_include_directories: false,
    },
)
[ERROR] Compilation failed.
[ERROR] Unable to run relay compiler. Error details: 
Watchman { source: WatchmanServerError { message: "failed to parse query: must use [\"suffix\", \"suffixstring\"]", command: "QueryRequest(\n    \"query\",\n    \"/home/coder/lwcode/fastglass/ui\",\n    QueryRequestCommon {\n        glob: None,\n        glob_noescape: false,\n        glob_includedotfiles: false,\n        path: Some(\n            [\n                RecursivePath(\n                    \"\",\n                ),\n            ],\n        ),\n        suffix: None,\n        since: None,\n        relative_root: None,\n        expression: Some(\n            All(\n                [\n                    FileType(\n                        Regular,\n                    ),\n                    Any(\n                        [\n                            All(\n                                [\n                                    All(\n                                        [\n                                            Suffix(\n                                                [\n                                                    \"js\",\n                                                    \"jsx\",\n                                                    \"ts\",\n                                                    \"tsx\",\n                                                ],\n                                            ),\n                                            DirName(\n                                                DirNameTerm {\n                                                    path: \"src\",\n                                                    depth: None,\n                                                },\n                                            ),\n                                        ],\n                                    ),\n                                    Not(\n                                        Any(\n                                            [\n                                                Match(\n                                                    MatchTerm {\n                                                        glob: \"**/node_modules/**\",\n                                                        wholename: true,\n                                                        include_dot_files: false,\n                                                        no_escape: false,\n                                                    },\n                                                ),\n                                                Match(\n                                                    MatchTerm {\n                                                        glob: \"**/__mocks__/**\",\n                                                        wholename: true,\n                                                        include_dot_files: false,\n                                                        no_escape: false,\n                                                    },\n                                                ),\n                                                Match(\n                                                    MatchTerm {\n                                                        glob: \"**/__generated__/**\",\n                                                        wholename: true,\n                                                        include_dot_files: false,\n                                                        no_escape: false,\n                                                    },\n                                                ),\n                                            ],\n                                        ),\n                                    ),\n                                ],\n                            ),\n                            Name(\n                                NameTerm {\n                                    paths: [\n                                        \"dummy.graphql\",\n                                    ],\n                                    wholename: true,\n                                },\n                            ),\n                        ],\n                    ),\n                ],\n            ),\n        ),\n        fields: [\n            \"name\",\n            \"exists\",\n        ],\n        empty_on_fresh_instance: false,\n        omit_changed_files: false,\n        fail_if_no_saved_state: false,\n        case_sensitive: false,\n        sync_timeout: Default,\n        settle_period: None,\n        settle_timeout: None,\n        dedup_results: false,\n        lock_timeout: None,\n        request_id: None,\n        always_include_directories: false,\n    },\n)" } }
coder@ameys-workspace:~/lwcode/fastglass/ui$ pyenv shell 3.9.13
pyenv: shell integration not enabled. Run `pyenv init' for instructions.

Running Relay Compiler (via Command Line)

coder@ameys-workspace:~/lwcode/fastglass/ui$ npm run relay

> ui@0.1.0 relay
> relay-compiler

[INFO] querying files to compile...
[ERROR] Watchman error: The watchman server reported an error: "failed to parse query: must use ["suffix", "suffixstring"]", while executing command: QueryRequest(
    "query",
    "/home/coder/lwcode/fastglass/ui",
    QueryRequestCommon {
        glob: None,
        glob_noescape: false,
        glob_includedotfiles: false,
        path: Some(
            [
                RecursivePath(
                    "",
                ),
            ],
        ),
        suffix: None,
        since: None,
        relative_root: None,
        expression: Some(
            All(
                [
                    FileType(
                        Regular,
                    ),
                    Any(
                        [
                            All(
                                [
                                    All(
                                        [
                                            Suffix(
                                                [
                                                    "js",
                                                    "jsx",
                                                    "ts",
                                                    "tsx",
                                                ],
                                            ),
                                            DirName(
                                                DirNameTerm {
                                                    path: "src",
                                                    depth: None,
                                                },
                                            ),
                                        ],
                                    ),
                                    Not(
                                        Any(
                                            [
                                                Match(
                                                    MatchTerm {
                                                        glob: "**/node_modules/**",
                                                        wholename: true,
                                                        include_dot_files: false,
                                                        no_escape: false,
                                                    },
                                                ),
                                                Match(
                                                    MatchTerm {
                                                        glob: "**/__mocks__/**",
                                                        wholename: true,
                                                        include_dot_files: false,
                                                        no_escape: false,
                                                    },
                                                ),
                                                Match(
                                                    MatchTerm {
                                                        glob: "**/__generated__/**",
                                                        wholename: true,
                                                        include_dot_files: false,
                                                        no_escape: false,
                                                    },
                                                ),
                                            ],
                                        ),
                                    ),
                                ],
                            ),
                            Name(
                                NameTerm {
                                    paths: [
                                        "dummy.graphql",
                                    ],
                                    wholename: true,
                                },
                            ),
                        ],
                    ),
                ],
            ),
        ),
        fields: [
            "name",
            "exists",
        ],
        empty_on_fresh_instance: false,
        omit_changed_files: false,
        fail_if_no_saved_state: false,
        case_sensitive: false,
        sync_timeout: Default,
        settle_period: None,
        settle_timeout: None,
        dedup_results: false,
        lock_timeout: None,
        request_id: None,
        always_include_directories: false,
    },
)
[ERROR] Compilation failed.
[ERROR] Unable to run relay compiler. Error details: 
Watchman error: The watchman server reported an error: "failed to parse query: must use ["suffix", "suffixstring"]", while executing command: QueryRequest(
    "query",
    "/home/coder/lwcode/fastglass/ui",
    QueryRequestCommon {
        glob: None,
        glob_noescape: false,
        glob_includedotfiles: false,
        path: Some(
            [
                RecursivePath(
                    "",
                ),
            ],
        ),
        suffix: None,
        since: None,
        relative_root: None,
        expression: Some(
            All(
                [
                    FileType(
                        Regular,
                    ),
                    Any(
                        [
                            All(
                                [
                                    All(
                                        [
                                            Suffix(
                                                [
                                                    "js",
                                                    "jsx",
                                                    "ts",
                                                    "tsx",
                                                ],
                                            ),
                                            DirName(
                                                DirNameTerm {
                                                    path: "src",
                                                    depth: None,
                                                },
                                            ),
                                        ],
                                    ),
                                    Not(
                                        Any(
                                            [
                                                Match(
                                                    MatchTerm {
                                                        glob: "**/node_modules/**",
                                                        wholename: true,
                                                        include_dot_files: false,
                                                        no_escape: false,
                                                    },
                                                ),
                                                Match(
                                                    MatchTerm {
                                                        glob: "**/__mocks__/**",
                                                        wholename: true,
                                                        include_dot_files: false,
                                                        no_escape: false,
                                                    },
                                                ),
                                                Match(
                                                    MatchTerm {
                                                        glob: "**/__generated__/**",
                                                        wholename: true,
                                                        include_dot_files: false,
                                                        no_escape: false,
                                                    },
                                                ),
                                            ],
                                        ),
                                    ),
                                ],
                            ),
                            Name(
                                NameTerm {
                                    paths: [
                                        "dummy.graphql",
                                    ],
                                    wholename: true,
                                },
                            ),
                        ],
                    ),
                ],
            ),
        ),
        fields: [
            "name",
            "exists",
        ],
        empty_on_fresh_instance: false,
        omit_changed_files: false,
        fail_if_no_saved_state: false,
        case_sensitive: false,
        sync_timeout: Default,
        settle_period: None,
        settle_timeout: None,
        dedup_results: false,
        lock_timeout: None,
        request_id: None,
        always_include_directories: false,
    },
)

Autocompletes and other editor integration features have not worked either.

System Details

Watchman Version

Installed via apt-get.

$ watchman --version
4.9.0

Ubuntu Version

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:        22.04
Codename:       jammy

package.json

"relay-runtime": "15.0.0",
...
..
"babel-plugin-relay": "15.0.0",
"relay-compiler": "^15.0.0",
zth commented 1 year ago

You need an as recent watchman version as possible. Looks like you have an old one. It's messy because Homebrew etc ships old versions IIRC, so you need to install a recently built one.

edvinerikson commented 1 year ago

linuxbrew contain updated versions:

watchman --version
2023.02.13.00

From the watchman install instructions page

Warning: Do not install the Ubuntu-supplied Watchman package. It is old and missing security, bug, and performance fixes.