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

Invariant Violation: RelayQueryField() in todo example #408

Closed
reginedanica opened this issue Oct 1, 2015 · 9 comments
Closed

Invariant Violation: RelayQueryField() in todo example #408

reginedanica opened this issue Oct 1, 2015 · 9 comments
Assignees

Comments

@reginedanica
Copy link

I tried to remove items in the todo list and I got this error

'Uncaught Error: Invariant Violation: RelayQueryField(): Expected field id to be annotated with the type of the parent field.'

@wincent
Copy link
Contributor

wincent commented Oct 1, 2015

Thanks for the report, @reginedanica. What version of the code are you running? I can't repro this on the current HEAD of master.

Maybe you are running an old version of the babel-relay-plugin. Try running npm install && npm run update-schema && npm run start in the todo example and see if you can repro.

@zigomir
Copy link

zigomir commented Oct 1, 2015

@wincent I have same problem. I'm running 1844dc9 atm.
Running npm run update-schema will fill few description fields inside schema.json.

@N0hbdy
Copy link

N0hbdy commented Oct 2, 2015

Also, at fe3e78f I'm unable to add a new todo, probably for the same reason?

Full error message:
Uncaught Error: Invariant Violation: RelayQueryField(): Expected fieldidto be annotated with the type of the parent field.

@pcarion
Copy link

pcarion commented Oct 2, 2015

i have also this same error on the current HEAD - I did run:

npm install && npm run update-schema && npm run start

The error is due to an invariant at:
https://github.com/facebook/relay/blob/master/src/query/RelayQuery.js#L890

under debugger, it appears that
this.__concreteNode__ is:

GraphQLFieldNode {
  kind: "Field", 
__proto__: GraphQLFieldNode,
  fieldName: "id"}

but this.__concreteNode__.metadata is:

edgesID: undefined
inferredPrimaryKey: undefined
inferredRootCallName: undefined
isConnection: false
isFindable: false
isGenerated: false
isPlural: false
isRequisite: false
isUnionOrInterface: false
parentType: undefined

and so that fails the invariant in:

getParentType(): string {
    var parentType = this.__concreteNode__.metadata.parentType;
    invariant(
      parentType,
      'RelayQueryField(): Expected field `%s` to be annotated with the ' +
      'type of the parent field.',
      this.getSchemaName()
    );
    return parentType;
  }

@steveluscher
Copy link
Contributor

Yep! We broke this. @josephsavona is on it!

@josephsavona
Copy link
Contributor

Oops! Looking at it.

josephsavona added a commit that referenced this issue Oct 2, 2015
Summary: addresses #408
Closes #414

Reviewed By: @steveluscher

Differential Revision: D2503070
@pcarion
Copy link

pcarion commented Oct 3, 2015

I can confirm that the TodoMVC app is working now. Thanks!

@josephsavona
Copy link
Contributor

@pcarion thanks for double-checking ;-)

@reginedanica
Copy link
Author

Thanks a lot guys!

wincent added a commit that referenced this issue Oct 13, 2015
Summary: While investigating an issue reported for the todomvc example (#408), I found that `npm install` in an example directory was blowing up because I didn't have `babel` installed globally:

```
sh: babel: command not found
```

(Full output at https://gist.github.com/wincent/3221694ee3fdc46084f4)

What's happening here:

- Example's `preinstall` runs `install` from the top-level.
- Top-level `install` installs its babel-relay-plugin dependency from NPM.
- Example's `install` runs, and runs `build` from the babel-relay-plugin `file:../` dependency.
- Note that `install` hasn't happened inside the `file:../` dependency yet, which means that the `babel` call will blow up if not globally installed.

Fix:

- Make sure the example's `preinstall` step `cd`'s into the `file:../` dependency and installs its dependencies (ie. `babel`) up front.

Tested: Blow away global babel (`npm uninstall -g babel`), example `node_modules` and top-level `node_modules`, then `npm install` from inside an example or top-level; see it no longer blows up. Also `npm run update-schema` works, as does `npm run start`.
Closes #409

Reviewed By: @josephsavona

Differential Revision: D2536562

fb-gh-sync-id: fbd5e3c1a8b16747acc219e58fe896f39a32b394
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

7 participants