Aws-mobile-appsync-sdk-js: Disable persistence in a node environment?

Created on 15 Aug 2018  路  1Comment  路  Source: awslabs/aws-mobile-appsync-sdk-js

I am running in a node environment and am getting this.

redux-persist asyncLocalStorage requires a global localStorage object. Either use a different storage backend or if this is a universal redux application you probably should conditionally persist like so: https://gist.github.com/rt2zz/ac9eb396793f95ff3c3b

I have a index.js that is similar to the one shown here for Lambda:
https://docs.aws.amazon.com/appsync/latest/devguide/building-a-client-app-node.html

The error says just put this somewhere
if (typeof self === 'object') persistStore(store)

I can't figure out where to put that. How do I disable redux persistence in AppSync?

Most helpful comment

Hi @rygo6

You can try disabling offline support:

const client = new AWSAppSyncClient({
    url: AppSync.graphqlEndpoint,
    region: AppSync.region,
    auth: {
        type: AUTH_TYPE.API_KEY,
        apiKey: AppSync.apiKey,
    },
    disableOffline: true
});

>All comments

Hi @rygo6

You can try disabling offline support:

const client = new AWSAppSyncClient({
    url: AppSync.graphqlEndpoint,
    region: AppSync.region,
    auth: {
        type: AUTH_TYPE.API_KEY,
        apiKey: AppSync.apiKey,
    },
    disableOffline: true
});
Was this page helpful?
0 / 5 - 0 ratings