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

The field named js in the schema causes the Relay compiler to fail when this field is requested in the query #4722

Open
SiarheiBarysenka opened this issue Jun 21, 2024 · 5 comments

Comments

@SiarheiBarysenka
Copy link

Problem

The field named js in the schema causes the Relay compiler to fail when this field is requested in the query.

Steps to reproduce

  1. Define the following schema:
type Query {
  hello: String
  js: String
}

schema {
  query: Query
}
  1. Define the following query:
const query = graphql`
  query srcAppQuery {
    hello
    js
  }
`;
  1. Execute the Relay compiler to generate the query and observe the output in the console.

Expected Result

The query is generated successfully. Expected output in the console:

> [email protected] relay
> relay-compiler

[INFO] [default] compiling...
[INFO] [default] compiled documents: 1 reader, 1 normalization, 1 operation text
[INFO] Compilation completed.
[INFO] Done.

Actual Result

The query generation fails. Actual output in the console:

> [email protected] relay
> relay-compiler

[INFO] [default] compiling...
[ERROR] Error: ✖︎ 'js' should be defined on the server schema.

  src/index.ts:6:5
    5 │     hello
    6 │     js
      │     ^^
    7 │   }

[ERROR] Compilation failed.
[ERROR] Unable to run relay compiler. Error details: 
Failed to build:
 - Validation errors: 1 error(s) encountered above.

Notes

  1. If the js field is removed from the definition of srcAppQuery, the query is generated successfully (but obviously without the js field included).
  2. The sample project to reproduce the issue is available at https://github.com/SiarheiBarysenka/bug-relay-compiler-js-field .
@captbaritone
Copy link
Contributor

captbaritone commented Jun 22, 2024

I was able to reproduce in the compiler explorer.

Likely some bug in our @match validation here or more likely here

@SiarheiBarysenka
Copy link
Author

Thank you @captbaritone 🙏 Is this something that can be addressed in the foreseeable future?

@SiarheiBarysenka
Copy link
Author

Hey @captbaritone I wonder if there's any update on this? Thanks!

@SiarheiBarysenka
Copy link
Author

Hey @captbaritone Is there any updates on the fix timelines for this issue? Thanks.

@captbaritone
Copy link
Contributor

I don't think we have active plans to work on this this, but folks are welcome to look at the code pointers I shared and work on a fix or at least narrowing down where the issue is. Sorry we don't have bandwidth to fix right now.

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

No branches or pull requests

2 participants