graphql-client.js
const authClientConfig = {
url: process.env.NEXT_PUBLIC_APPSYNC_GRAPHQL_ENDPOINT,
region: process.env.NEXT_PUBLIC_REGION,
auth: {
type: "AMAZON_COGNITO_USER_POOLS",
jwtToken,
},
};
const link = ApolloLink.from([
createAuthLink({
url: authClientConfig.url,
region: authClientConfig.region,
auth: authClientConfig.auth,
}),
createSubscriptionHandshakeLink({
url: authClientConfig.url,
region: authClientConfig.region,
auth: authClientConfig.auth,
}),
]);
const FinedeedsAppClient = new ApolloClient({
link,
cache: new InMemoryCache(),
});
return FinedeedsAppClient;
package.json
aws-appsync-subscription-link : ^3.0.11
@apollo/client: ^3.6.8
apollo-link-http: ^1.5.17
aws-appsync-auth-link: ^3.0.7
apollo-link : ^1.2.14
I'm using nextjs on frontend and getting below error after initializing apollo client with aws-appsync subscription
TypeError: Cannot read properties of undefined (reading 'subscriptionFailedCallback')
You might need to disable strict mode in your
next.config.jsfile as reported here.