I'm using AWS AppSync
with Apollo
. So far, so good except that I just realised that all my mutations are not working properly :
In the devtool, I can see the returned data like this:
{
"data": {
"getProduct": {
"productId": "xxxxxxxxxxxxxxxxxxx",
"title": "my title",
"slug": "my slug"
}
}
}
...but when I try to console.log these same data, I get null. It does that only with my mutations (queries works fine).
{
"data": {
"getProduct": null
}
}
Here is what I'm doing:
addProduct(variables): Observable<Product> {
return this.apollo.mutate({
mutation: gql`
mutation addProduct($product: AddProductInput) {
addProduct(product: $product) {
productId
title
slug
}
}
`,
variables
}).pipe(
tap(console.log)
)
}
After few hours trying to find a solution, I tried to replace Apollo
with AWS Amplify
and It worked as expected.
The thing is that I don't want to use AWS Amplify
. I can't use fragments/offline/optimistic UI/fetchPolicy... and I really need these.
So I'm wondering if that is supposed to be like this or am I missing something here?
With the help of Kamil Kisiela, we have find out that it worked again when adding disableOffline: true
to AWSAppSyncClient
.
So I looked for bugs that looked like this and I found this.
Then I upgraded aws-appsync
to 1.3.3
and it worked all the time, even without disableOffline: true
. Yay!