Problems after rebuilding node_modules with latest npm packages
See original GitHub issueRebuilt my react native project’s node modules folder and re-ran npm install. Now I’m seeing some problems that were non-existent previously
- On Mutate, “Cannot read property ‘data’ of undefined at Mutation._this.onCompletedMutation” in react-apollo.browser.umd.js:557
- Following 2, “Cannot read property ‘queryManager’ of undefined” in offline-link.js:97:31
The mutation and query being composed:
let getEventSchedule = graphql(EventScheduleQuery, {
options: {
fetchPolicy: "network-only",
},
props: (props) => {
return {
eventSchedule: props.data.getEventSchedule,
}
}
});
let saveEvent = graphql(SaveEventMutation, {
props: (props) => ({
saveEvent: event => {
props.mutate({
variables: {
...event
},
refetchQueries: [{query: getEventSchedule}]
})
}
})
});
It’s been maybe two weeks since I’ve rebuilt the node modules folder but the app was working perfectly with the previous contents. Any ideas?
Some debugging shows that a call to getContext in offline-link.js doesn’t return the client at all, whih explains . number 2, but I don’t know what could be causing that
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
npm rebuild doesn't work when trying to fix different node ...
Solved the issue, I was using an outdated version of node as I was using node v16.13.2 so I tried switching to the...
Read more >reinstall-node-modules - npm
(re)install node modules only if they have changed. Latest version: 2.0.0, last published: 3 years ago. Start using reinstall-node-modules ...
Read more >Native Node Modules | Electron
If you installed a native module and found it was not working, you need to check the following things: When in doubt, run...
Read more >Configuring your application's dependencies - AWS Elastic ...
To avoid needing to create a new environment, change the Node.js version setting in package.json to a Node.js version that is supported by...
Read more >Cannot find module 'node-sass' on NPM build
There was an outage on Friday 8th at about 1700 GMT, we had an NPM/Angular build in progress. since then our devops builds...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was getting the same offline-link.js error for
queryManager
being undefined. I fixed it (temporarily) by addingdisableOffline: true
to the AppSyncClient like so:I don’t fully understand why, seems like the offline feature should be checking for something, but seems like a bug that should be fixed. I initially got the idea to try it from here: https://stackoverflow.com/questions/48529063/reactjs-apollo-appsync-mutation-optimistic-response-resolved-id
This also related to https://github.com/awslabs/aws-mobile-appsync-sdk-js/issues/159
https://github.com/awslabs/aws-mobile-appsync-sdk-js/blob/79aaaff2444b9772932637ea8c7128c1bdc698a5/packages/aws-appsync/src/client.ts#L204
Since
doIt
is always false, it didn’t set theclient
. When do you mutation, it will reach the following codehttps://github.com/awslabs/aws-mobile-appsync-sdk-js/blob/5897091e3e9c67babee55b9defe7474f8e30a0b6/packages/aws-appsync/src/link/offline-link.ts#L88
Because
client
is undefined due todoIt
is false, it throwsCannot read property 'queryManager' of undefined
I don’t understand how
doIt
value is being set. Need some helps from AWS team.Just a fun fact that their example in the other repo also given up with the
offline-link
https://github.com/aws-samples/aws-amplify-graphql/blob/master/photo-client/src/App.js#L27