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

Relay compiler panics if the schema file path starts with ./ and watchman is being used #4897

Open
captbaritone opened this issue Jan 28, 2025 · 0 comments

Comments

@captbaritone
Copy link
Contributor

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:

Validating that the schema file exists is done here:

let abs_schema_file = self.root_dir.join(schema_file);
if !abs_schema_file.exists() {
errors.push(ConfigValidationError::SchemaFileNotExistent {
project_name,
schema_file: abs_schema_file.clone(),
});
} else if !abs_schema_file.is_file() {
errors.push(ConfigValidationError::SchemaFileNotFile {
project_name,
schema_file: abs_schema_file.clone(),
});
}

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

No branches or pull requests

2 participants