Aws-mobile-appsync-sdk-js: "Error storing data for key: appsync DOMException: Failed to execute 'setItem' on 'Storage'"

Created on 30 Jun 2018  路  3Comments  路  Source: awslabs/aws-mobile-appsync-sdk-js

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?

pending-close-response-required

Most helpful comment

@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

All 3 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yarax picture yarax  路  3Comments

peterservisbot picture peterservisbot  路  3Comments

chaim007 picture chaim007  路  4Comments

asadowns picture asadowns  路  3Comments

e-yoshi picture e-yoshi  路  3Comments