Open ffxsam opened 5 years ago
@ffxsam this worked for vue-apollo before, Maybe that was breaking change from them, can you paste you package.json to reproduce the issue? Thanks!
Hey @elorzafe! I actually stopped using Apollo in favor of AppSync's own methods for queries/mutations/etc. Here's the package.json from back when I was still using vue-apollo though:
"dependencies": {
"apollo-client": "^2.4.13",
"apollo-link": "^1.2.8",
"aws-amplify": "^1.1.19",
"aws-appsync": "^1.7.1",
"buefy": "^0.7.2",
"change-case": "^3.1.0",
"graphql": "^14.1.1",
"graphql-tag": "^2.10.1",
"lodash": "^4.17.11",
"uuid": "^3.3.2",
"vue": "^2.5.21",
"vue-apollo": "^3.0.0-beta.28",
"vue-i18n": "^8.0.0",
"vue-router": "^3.0.1",
"vuelidate": "^0.7.4",
"vuex": "^3.0.1",
"vuex-persistedstate": "^2.5.4"
},
Thanks @ffxsam, let me know if you need anything else.
Happening on React too, on the line:
<ApolloProvider client={appSyncClient}>
...
</ApolloProvider>
Type 'AWSAppSyncClient<any>' is missing the following properties from type 'ApolloClient<{}>': typeDefs, clearStoreCallbacks, clientAwareness, localState, and 6 more. ts(2740)
ApolloProvider.d.ts(6, 5): The expected type comes from property 'client' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<ApolloProvider<{}>> & Pick<Readonly<ApolloProviderProps<{}>> & Readonly<{ children?: ReactNode; }>, "client" | "children"> & Pick<...> & Pick<...>'
This is with versions:
"aws-appsync": "^1.7.2",
"aws-appsync-react": "^1.2.7",
"react-apollo": "^2.5.3",
Looks to be related to https://github.com/awslabs/aws-mobile-appsync-sdk-js/issues/166 afaik @elorzafe (since it's the same error after all)
Also had this problem. We resolved it by doing this. Yes it's a hack, but at least you can get by until the issue is resolved. 😄
Given this appsync config:
const client = new AWSAppSyncClient({
url: process.env.REACT_APP_AWS_APPSYNC_GRAPHQLENDPOINT as string,
region: process.env.REACT_APP_AWS_APPSYNC_REGION as string,
auth: {
type: AUTH_TYPE.OPENID_CONNECT,
jwtToken: () => getUser().token,
},
});
And then doing:
<ApolloProvider client={client as any}>
Hello everyone - I want to reply and assure you that we have not abandoned support of this project. Per my earlier comment, this is a complex process and to be completely transparent there are things in the Apollo library that are out of our control and there have also been breaking changes in Apollo versions which we're trying to account for, which is also why we pinned the version. We've been spending many hours trying to account for this but it's not simple to solve. After putting more thought into this we've got some initial solutions that I hope will unblock many of you. What we've done is packaged two of the "Links" which are part of the SDK - the Auth and Subscription Links - and published them to NPM. This will allow you to include them in the newer Apollo versions if you wish to use the newer features. This does not include the "Offline Link" for offline support which is more complex to solve and we're looking into for the future.
Installation of the links:
npm install aws-appsync-auth-link aws-appsync-subscription-link
With is I would then give the following recommendations for choosing your client strategy:
Please let us know if you have any trouble using these links or if there is a scenario which we haven't accounted for here.
I'm getting the following TS error:
AppSync works fine when it uses its own version of apollo-client that it depends on. But vue-apollo requires us to run
yarn add apollo-client
which installs a newer version that causes AppSync's types to break.