I have been working on an app that uses AppSync for a few weeks when I suddenly started getting this error.
"Error storing data for key: appsync DOMException: Failed to execute 'setItem' on 'Storage'"
It seems that the AppSync client is writing to local storage in the browser under "reduxPersist:appsync" without ever trimming it.
Is there any way to to have the AppSync client delete entries from the cache when it begins to fill up?
Also, is there any way to have the AppSync client use an in-memory cache instead of using local storage?
This is definitely an issue in our ReactNative application with respect to the reduxPersist:appsync key in AsyncStorage as well.
I believe a similar issue has been raised previously here.
In our case, there's also a reduxPersist:appsync-metadata key that is also never garbage collected.
@fcobia @jessedoyle you can customize Storage options like this.
import * as localForage from "localforage";
const client = new AWSAppSyncClient({
url: appSyncConfig.graphqlEndpoint,
region: appSyncConfig.region,
auth: {
type: appSyncConfig.authenticationType,
apiKey: appSyncConfig.apiKey,
},
offlineConfig: {
storage: localForage,
},
});
https://github.com/awslabs/aws-mobile-appsync-sdk-js#custom-storage-engine
Let me know how it goes
I will close this for now, but feel free @fcobia or @jessedoyle to reopen this issue or to create a new one.
Most helpful comment
@fcobia @jessedoyle you can customize Storage options like this.
https://github.com/awslabs/aws-mobile-appsync-sdk-js#custom-storage-engine
Let me know how it goes