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

Undefined error when using apollo-boost/apollo-cache-inmemory. #4218

Closed
joelmandell opened this issue Dec 5, 2018 · 6 comments
Closed

Undefined error when using apollo-boost/apollo-cache-inmemory. #4218

joelmandell opened this issue Dec 5, 2018 · 6 comments

Comments

@joelmandell
Copy link

Hey! I am using apollo-cache-inmemory 1.3.11, tried backwards to 1.3.4. But I get same error as screenshot below shows:

image

What am I doing wrong?

@joelmandell
Copy link
Author

I would like to clarify, that this happens when I import apollo-boost.

Anyway, I solved this by importing apollo-cache-inmemory, and those requirements by myself instead of using apollo-boost. And then I do not get this exception.

@joelmandell joelmandell changed the title Undefined error when using apollo-cache-inmemory. Undefined error when using apollo-boost/apollo-cache-inmemory. Dec 6, 2018
@benjamn
Copy link
Member

benjamn commented Dec 6, 2018

Is the graphql package installed in your app? That's where QueryDocumentKeys is supposed to be coming from (specifically, from the graphql/language/visitor module).

@joelmandell
Copy link
Author

Yes, it is. This is my package.json:

  "dependencies": {
    "apollo-boost": "^0.1.22",
    "apollo-cache-inmemory": "1.4.0-alpha.1",
    "apollo-client": "^2.4.7",
    "apollo-link-http": "^1.5.7",
    "bootstrap": "^3.3.7",
    "graphql": "^14.0.2",
    "graphql-tag": "^2.10.0",
    "react": "^16.0.0",
    "react-apollo": "^2.3.2",
    "react-bootstrap": "^0.31.5",
    "react-dom": "^16.0.0",
    "react-router-bootstrap": "^0.24.4",
    "react-router-dom": "^4.2.2",
    "react-scripts": "1.0.17",
    "rimraf": "^2.6.2"
  }

@joelmandell
Copy link
Author

Is the graphql package supposed to be installed in node_modules\apollo-boost\node_modules?
As it is now, folder structure is like this:
image

I removed the node_modules from ClientApp folder, and did "npm install" from scratch. Still same problem.
Is it suppose to contain graphql in itself? E.g. node_modules\apollo-boost\node_modules\graphql?

@arist0tl3
Copy link

What a goose chase, lol.

@joelmandell If you update your react-scripts to ^1.1.2, I think you will see this issue resolved. Relevant comment and thread: graphql/graphql-js#1248 (comment)

tl;dr: react-scripts prior to 1.1.2 wasn't respecting .mjs files, leading to an undefined export in this case.

@joelmandell
Copy link
Author

Yea that is probarly it. This was a project based on an .net core template.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants