I am using Magento 2.3.6
and have installed Amazon Sales Channel 4.4.0
, I have added the Production API Key
and Production Private Key
under Magento Services
but I get this error "Unexpected network error
", can anyone explain what causes this error?
Click Add Amazon Store and I get this error:
Browser Console: GRAPHQL ERROR: Error: GraphQL error: Internal server error https://cdn.amazon.channels.magento.com/4.4.0/static/js/components/HelperFunctions/GQLErrorHandler.tsx
import { ApolloError } from 'apollo-client';
interface MagentoNetworkError {
name: string;
response: {};
statusCode: number;
result: {
ajaxExpired: number;
ajaxRedirect: string;
};
}
/*
If Magento is open in 2+ tabs, and the user signs out in one of them, all
the other sessions will also be terminated. All GQL queries & mutations will
return a Network Error that follow the pattern in the interface above.
If that's the case, display a toast
that will not go way. If it's any other error, then just display whatever
custom message was passed in.
*/
export const GQLErrorHandler = (error: ApolloError | undefined, message?: string) => {
let networkError = (error?.networkError as unknown) as MagentoNetworkError;
if (process.env.NODE_ENV !== 'production') {
console.error(error);
}
if (
networkError &&
networkError.result &&
networkError.result.ajaxExpired &&
networkError.result.ajaxRedirect
) {
errorToast(`Your session has timed out.`, {
actionLabel: 'Sign in',
onAction: () => {
window.location.replace(networkError.result.ajaxRedirect);
},
timeout: 0,
});
} else if (error) {
let errorMessage = message ?? 'Unexpected network error, please try again later.';
errorToast(errorMessage);
}
console.error('GRAPHQL ERROR: \n ' + error);
};