react-nativegraphqlrelayreact-relay

Unable to run relay-compiler


I installed the relay for my react-native project following the steps on relay.dev. Running the compiler works fine when I have an empty schema file. Putting schema to the file starts throwing me this error:

thread 'main' panicked at 'Expect GraphQLAsts to exist.', /home/runner/work/relay/relay/compiler/crates/relay-compiler/src/compiler.rs:335:14 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

My schema file is

// relay_schema.graphql

type Query {
  tasks: [TaskNode]
}

type TaskNode {
  id: ID!
}

and my relay config is:

module.exports = {
  // ...
  // Configuration options accepted by the `relay-compiler` command-line tool and `babel-plugin-relay`.
  src: './src/',
  language: 'flow',
  schema: './relay_schema.graphql',
  exclude: ['**/node_modules/**', '**/__mocks__/**', '**/__generated__/**'],
};

I'm completely lost on what to do here


Solution

  • Started working after updating src to src: './'. It's better to verify the paths such as src and schema. Error messages shown by the compiler are not much help when stuck here.