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

[modern] relay-compiler: createRefetchContainer expects a second argument of fragment definitions. #1635

Closed
alex-wilmer opened this issue Apr 19, 2017 · 7 comments

Comments

@alex-wilmer
Copy link

alex-wilmer commented Apr 19, 2017

This is the result of running "relay": "relay-compiler --src . --schema schema.graphql"

This isn't a "relay" compliant schema, but is that the problem?

type Link {
  id: ID
  url: String
  description: String
  tags: [Tag]
}

type Mutation {
  createLink(url: String!, description: String, tags: [TagInput]): Link
  createTag(name: String!): Tag
}

type Query {
  links(id: ID): [Link]
  tags(id: ID): [Tag]
}

type Tag {
  id: ID
  name: String
  links: [Link]
}

input TagInput {
  name: String!
}

error:

Error: FindGraphQLTags: `createRefetchContainer` expects a second argument of fragment definitions.
    at invariant (/Users/awilmer/Projects/venn/node_modules/relay-compiler/bin/relay-compiler:4401:12)
    at CallExpression (/Users/awilmer/Projects/venn/node_modules/relay-compiler/bin/relay-compiler:4270:82)
    at visit (/Users/awilmer/Projects/venn/node_modules/relay-compiler/bin/relay-compiler:4408:6)
    at traverse (/Users/awilmer/Projects/venn/node_modules/relay-compiler/bin/relay-compiler:4421:8)
    at visit (/Users/awilmer/Projects/venn/node_modules/relay-compiler/bin/relay-compiler:4411:4)
    at /Users/awilmer/Projects/venn/node_modules/relay-compiler/bin/relay-compiler:4425:12
    at Array.forEach (native)
    at traverse (/Users/awilmer/Projects/venn/node_modules/relay-compiler/bin/relay-compiler:4423:13)
    at visit (/Users/awilmer/Projects/venn/node_modules/relay-compiler/bin/relay-compiler:4411:4)
    at /Users/awilmer/Projects/venn/node_modules/relay-compiler/bin/relay-compiler:4425:12

repo: https://github.com/alex-wilmer/venn

@alex-wilmer alex-wilmer changed the title (modern) relay-compiler: createRefetchContainer expects a second argument of fragment definitions. [modern] relay-compiler: createRefetchContainer expects a second argument of fragment definitions. Apr 19, 2017
@josephsavona
Copy link
Contributor

josephsavona commented Apr 19, 2017

I don't see where in the repo you linked you have the createRefetchContainer call, can you provide a specific link? Note that the function signature is createRefetchContainer(component, fragments, query): the error suggests the second parameter is missing.

@alex-wilmer
Copy link
Author

alex-wilmer commented Apr 19, 2017

I haven't written any front end code yet.. I'm just following the instructions in the "Get Started" section

https://facebook.github.io/relay/docs/relay-modern.html#getting-started

What i've done so far:

  • Create a graphql schema
  • install the packages listed in Getting Started
  • use printSchema to generate schema.graphql
  • run the relay compiler script <----- this throws the error

@josephsavona
Copy link
Contributor

Super weird. Does the string createRefetchContainer appear anywhere? Can you narrow down which src file is causing this error?

@alangenfeld
Copy link

I am guessing it is picking up a createRefetchContainer from inside node_modules. We should probably blacklist that directory but in the mean time you can point --src at a directory of just your js files.

@alex-wilmer
Copy link
Author

alex-wilmer commented Apr 20, 2017

@alangenfeld indeed it was picking up node_modules. Is this something actionable I can make a PR for?

it was a little confusing error message even though it technically makes sense now

@alangenfeld
Copy link

@alex-wilmer
Copy link
Author

alex-wilmer commented Apr 24, 2017

hmm so this might be too explicit for all uses of a node_modules folder. we use node_modules for our own modules as well.

something like:

node_modules/ <-- npm packages
modules/
  node_modules/ <-- project modules

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

Successfully merging a pull request may close this issue.

3 participants