question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Attempted Import errors when migrating to Apollo 3.x

See original GitHub issue

Intended outcome: Migrating from @apollo/react-hooks and other packages to @apollo/client (3.4.7). After following migration guide, my intent was for things to work.

Actual outcome: Followed the migration guide. Have graphql 14.7.0 included in my package node_modules is populated as expected.

When running the dev server, I see the following:

project: ./node_modules/@apollo/client/core/LocalState.js
project: Attempted import error: 'BREAK' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/utilities/globals/graphql.js
project: Attempted import error: 'isType' is not exported from 'graphql'.
project: ./node_modules/graphql-tag/lib/index.js
project: Attempted import error: 'parse' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js
project: Attempted import error: 'print' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/link/http/createHttpLink.js
project: Attempted import error: 'visit' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/utilities/graphql/transform.js
project: Attempted import error: 'visit' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/utilities/graphql/transform.js
project: Attempted import error: 'visit' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/utilities/graphql/transform.js
project: Attempted import error: 'visit' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/utilities/graphql/transform.js
project: Attempted import error: 'visit' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/utilities/graphql/transform.js
project: Attempted import error: 'visit' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/utilities/graphql/transform.js
project: Attempted import error: 'visit' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/utilities/graphql/directives.js
project: Attempted import error: 'visit' is not exported from 'graphql'.
project: ./node_modules/@apollo/client/core/LocalState.js
project: Attempted import error: 'visit' is not exported from 'graphql'.
project: Search for the keywords to learn more about each warning.
project: To ignore, add // eslint-disable-next-line to the line before.

When inspecting my local node_modules, I see that visit and BREAK are exported by the graphql package.

How to reproduce the issue:

Versions 3.4.7 and attempted 3.3.20

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
emanuellarinicommented, Feb 8, 2022

For those who come here later having this issue I’m using absolute path imports and I had a folder in src/ called graphql which made the entire confusion around the typing for the TS… renaming the folder made everything work as expected

You can set traceResolution: true in your tsconfig.json to better display the error 😃

2reactions
dylanwulfcommented, Aug 18, 2021

@benjamn many people are stuck on graphql v14 because the apollo cli isn’t compatible with v15: https://github.com/apollographql/apollo-tooling/issues/2232

Read more comments on GitHub >

github_iconTop Results From Across the Web

Attempted Import errors when migrating to Apollo 3.4 - Help
js project: Attempted import error: 'visit' is not exported from 'graphql'. project: ./node_modules/@apollo/client/utilities/graphql/transform.
Read more >
Apollo-Client - Error: Could not identify object - Stack Overflow
what Im trying to achieve is updating the cached files with the new file, and re-render the component that contain the FilesQuery hook....
Read more >
@apollo/client | Yarn - Package Manager
Apollo Client is a fully-featured caching GraphQL client with integrations for React, Angular, and more. It allows you to easily build UI components...
Read more >
Pitfalls I fell into during Apollo Client 3.0 migration
import issue with `graphql-tag`. When I ran unit tests(jest) it stopped with an error message saying TypeError:(0, _client.gql) is not a function ......
Read more >
Automatically handling Apollo Client errors in your React UI
import { onError } from "@apollo/client/link/error" ; ... Let's start by moving the logic that creates the ApolloClient instance and renders ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found