Rebuilt my react native project's node modules folder and re-ran npm install. Now I'm seeing some problems that were non-existent previously
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
Dropped versions on aws-appsync and aws-appsync-react to 1.0.17 and 1.0.10 respectively. Things still work there for me.
Any luck on this?
I was getting the same offline-link.js error for queryManager being undefined. I fixed it (temporarily) by adding disableOffline: true to the AppSyncClient like so:
const client = new AWSAppSyncClient({
url: AppSync.graphqlEndpoint,
region: AppSync.region,
auth: {
type: AppSync.authenticationType,
jwtToken: this.state.token
},
disableOffline: true
});
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
Since doIt is always false, it didn't set the client.
When do you mutation, it will reach the following code
Because client is undefined due to doIt is false, it throws Cannot 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
@j0b0sapi3n Thanks for your help! It Is working now :)
Hi @jrounsav ,
I tried the same process as you:
Rebuilt my react native project's node modules folder and re-ran npm install.
In our react-native sample app, and I upgraded to the latest versions of both aws-appsync and aws-appsync-react, please see https://github.com/aws-samples/aws-mobile-appsync-events-starter-react-native/commit/61988f4c7b2bb2bd995520dec35f89f9dd6499dc
And I am not getting the behavior you are seeing. Do you happen to have simple reproduction steps?
Good find @j0b0sapi3n
Hey @manueliglesias
Not yet! Our app is pretty complicated and I suspect that one of the other dependencies aren't playing well with the appsync modules. Will update if I can isolate that behavior with the triggering calls.
Here's my dependency list though, at least of everything I think might be suspect
"apollo-client": "^2.3.5",
"aws-amplify-react-native": "^0.1.23",
"aws-appsync": "^1.0.20",
"aws-appsync-react": "^1.0.11",
"aws-sdk": "^2.233.1",
"graphql": "^0.13.2",
"graphql-tag": "^2.9.2",
"react": "16.0.0",
"react-apollo": "^2.1.6",
"react-native": "^0.50.4",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-thunk": "^2.2.0",
Most helpful comment
I was getting the same offline-link.js error for
queryManagerbeing undefined. I fixed it (temporarily) by addingdisableOffline: trueto 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