aws-mobile-appsync-sdk-js: Module not found: Can't resolve 'redux-persist/constants'

Note: If your issue/feature-request/question is regarding the AWS AppSync service, please log it in the official AWS AppSync forum

Do you want to request a feature or report a bug? Bug

What is the current behavior?

./node_modules/aws-appsync/lib/store.js Module not found: Can’t resolve ‘redux-persist/constants’ in ‘/Users/jeremynagel/dev/personal/recycling-hero/node_modules/aws-appsync/lib’

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

I installed the latest version of app-sync and am getting the above error.

import AWSAppSyncClient from 'aws-appsync';

import { APP_SYNC_REGION, APP_SYNC_URI, API_KEY } from './config';

export const client = new AWSAppSyncClient({
  url: APP_SYNC_URI,
  region: APP_SYNC_REGION,
  auth: {
    type: 'API_KEY',
    apiKey: API_KEY,
  },
  disableOffline: true
});

// ...
<ApolloProvider client={client as any}>
        <Rehydrated>
          ...
        </Rehydrated>
</ApolloProvider>

What is the expected behavior?

No errors

Which versions and which environment (browser, react-native, nodejs) / OS are affected by this issue? Did this work in previous versions?

 "aws-appsync": "^1.8.0",
    "aws-appsync-react": "^1.2.8",

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 6
  • Comments: 26

Commits related to this issue

Most upvoted comments

There is a workaround if you are impatient for the fix to be merged in, I used the npm install at version to get both v4 and v5 of redux-persist in my app:

npm install --save redux-persist5@npm:redux-persist
npm install --save redux-persist@4

Then, in your application, do like:

import { persistStore, persistReducer } from 'redux-persist5';

which lets the AWS framework continue to use the redux-persist moniker for v4 and import correctly

Hi,

I just updated the 2 packages aswell and get the same error now.

If it can help you, I temporary fixed it by changing in aws-appsync/lib/store.js line 68 var constants_2 = require(“redux-persist/constants”); by var constants_2 = require(“redux-persist/lib/constants”);

Exactly! That’s why I just did a pull request with the expected change. I hope they include it quickly. That’s really a shame they are not more reactive on this lib!

+1 , please update on the eta

Getting same issue, waiting for solusion

@jamesaucode superthanks! However there is actually another similar breaking dependency update needed. If you guys fix this too my hope for the future of development will come back 😂 There is a hack/workaround for that dependency issue but it involves switching to yarn and it does not work 100% of the times you run yarn install. So I am not sure how to tell all our developers to handle that project.

Its this issue https://github.com/awslabs/aws-mobile-appsync-sdk-js/issues/654

pretty please take a look at that too ❤️

The fix has been merged and will be included in the next release

@andidev absolutely! I will take a look at the issue you linked 😄

Bump. Is there any update on this?

It’s taking too long. PR is made 2 weeks ago, I guess??

Hi,

Yes it works, but just a little reminder that it’s usually not best practice or a good idea to modify directly a dependency. I’ve wrote this down just in case and also hoping that maybe the maintainers would see it and add it to a future release!