relay
relay copied to clipboard
Relay compiler panics if the schema file path starts with `./` and watchman is being used
It seems Watchman does not interpret paths with ./ in the same what that our checks for the existence of the file does. The result is that our initial validation ensuring we have a schema file passes, but when we initialize the project, no schema file is discovered by Watchman and thus when the compiler goes to look up the schema it panics.
I haven't been able to locate exactly the specification for what type of path Watchman expects, but I think we need to either find a way to correctly transform arbitrary paths into that format, or add validation which rejects configs which are not already in that format.
This is potentially a pretty big footgun for adopters of Relay. I myself hit it trying to setup a small project to repro an unrelated issue.
The invalid watchman file paths get constructed here: https://github.com/facebook/relay/blob/9b90142ae8135ac2bc5b42f9b6b093ba629beb0e/compiler/crates/relay-compiler/src/file_source/watchman_query_builder.rs#L56
Validating that the schema file exists is done here:
https://github.com/facebook/relay/blob/9b90142ae8135ac2bc5b42f9b6b093ba629beb0e/compiler/crates/relay-compiler/src/config.rs#L588-L599