Error: The keyPrefix reduxPersist: is already in use. Multiple clients cannot share the same keyPrefix. Provide a different keyPrefix in the offlineConfig object.

When I am upgrading expo from sdk-33 to sdk-40 version of expo. I am getting this issue, I have aws_appsync dependency in my react-native version 59.10.0.
The problem is occurring when I create new AWSAppSyncClient, I have set “disableOffline” property to true. Still I am getting this issue.

Is this any issue with upgrade expo or react-native dependencies?

Please help me to upgrade EXPO SDK-33 to SDK-40.

These are my dependency using in my application
“aws-amplify”: “^3.3.13”,
“aws-amplify-react-native”: “^4.0.1”,
“aws-appsync”: “^4.0.1”,
“aws-appsync-react”: “^4.0.1”,
“aws-sdk”: “^2.815.0”,

This way i am creating awsappscyncleint

export const stateLink = createLinkWithCache(cache =>
withClientState({
//cache,
defaults: initialState,
resolvers
})
);

export const linkError = onError(({graphQLErrors, networkError}) => {
if (graphQLErrors)
graphQLErrors.map(({ message, locations, path }) =>
alert(
[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}
)
);

if (networkError) {
    alert(`[Network error]: ${networkError}`);
}

})

const appSyncLink = createAppSyncLink({
url: aws_exports.aws_appsync_graphqlEndpoint,
disableOffline: true,
region: aws_exports.aws_appsync_region,
auth: {
type: aws_exports.aws_appsync_authenticationType,
jwtToken: async () =>
(await Auth.currentSession()).getIdToken().getJwtToken(),
credentials: () => Auth.currentCredentials()
},
offlineConfig: {
keyPrefix: ‘myPrefix’
}
});
const link = ApolloLink.from([linkError, stateLink, appSyncLink]);
export const client = new AWSAppSyncClient({}, { link });

https://github.com/aws-amplify/amplify-js/issues/3372

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.