I am configuring my React application to consume GraphQL APIs from the AppSync, I am using vite as a bundler for my application. Though I created the AppSync client but it is unable to run the application and producing such errors, I have looked over the internet but couldn't found anything related to it? Did anybody encountered that errors?
import AppSync from './AppSync';
import { ApolloProvider } from 'react-apollo';
import AWSAppSyncClient from 'aws-appsync';
import { Rehydrated } from 'aws-appsync-react';
const client = new AWSAppSyncClient({
url: AppSync.aws_appsync_graphqlEndpoint,
region: AppSync.aws_appsync_region,
auth: {
type: 'API_KEY',
apiKey: AppSync.aws_appsync_apiKey,
},
});
<React.StrictMode>
<Provider store={store}>
<ApolloProvider client={client}>
<Rehydrated>
<App />
</Rehydrated>
</ApolloProvider>
</Provider>
</React.StrictMode>
This code is written in v2 version, However the apollo-react has been deprecated. The v3 can be used using the @apollo-client. I have that code as well but the error remains the same. I believe it more related to the vite bundler incompatibility with aws-sdk.