Amplify-js: TypeError: Cannot read property 'computeModPow' of undefined

Created on 19 Jan 2018  路  8Comments  路  Source: aws-amplify/amplify-js

I was able to signUp on both platforms. But when I was trying to use Auth.signIn from aws-amplify-react-native ^0.1.24, it throws this error on both Android and iOS.

TypeError: Cannot read property 'computeModPow' of undefined
    at BigInteger.nativeModPow [as modPow] (enhance-rn.js:17)
    at AuthenticationHelper.calculateA (AuthenticationHelper.js:167)
    at AuthenticationHelper.getLargeAValue (AuthenticationHelper.js:75)
    at new AuthenticationHelper (AuthenticationHelper.js:53)
    at CognitoUser.authenticateUser (CognitoUser.js:195)
    at Auth.js:236
    at tryCallTwo (core.js:45)
    at doResolve (core.js:200)
    at new Promise (core.js:66)
    at AuthClass.signIn (Auth.js:235)
investigating

Most helpful comment

@lichao0817 It looks like the native module perhaps isn't linked. Did you run:

react-native link amazon-cognito-identity-js

All 8 comments

@lichao0817 It looks like the native module perhaps isn't linked. Did you run:

react-native link amazon-cognito-identity-js

@mlabieniec Cool! This works. One more question, do I have to do an npm install --save amazon-cognito-identity-js module?

@lichao0817 no you shouldn't include this as it's already a dep of the aws-amplify-react-native library. You only need to do the react-native link portion. Process here:
https://github.com/aws/aws-amplify/blob/master/media/quick_start.md#react-native-development

Great! Thanks a lot for the help!

I had this issue with aws-amplify 0.3.3.
When I run react-native link amazon-cognito-identity-js I received _error: cannot find symbol
new RNAWSCognitoPackage()_
To solve this problem just add to android/app/build.gradle in _dependencies_ section compile project(':amazon-cognito-identity-js')
It helped me.

Hey = I am stuck with these issues on Android with an ejected project too, have tried adding the compile project(':amazon-cognito-identity-js') and linking using react-native link amazon-cognito-identity-js. No issues on ios. Also, I am importing the Auth module using import Amplify, {Auth} from 'aws-amplify';. Have been completely stuck on this for hours now though, does anyone know if cognito-identity-js is in general pretty unreliable?

@BenjaminWatts if amazon-cognito-identity-js is not a dependency of your project and you rely on aws-amplify for this dependency (as @mlabieniec suggested), then you should use in your settings.gradle:
include ':amazon-cognito-identity-js' project(':amazon-cognito-identity-js').projectDir = new File(rootProject.projectDir, '../node_modules/@aws-amplify/auth/node_modules/amazon-cognito-identity-js/android')

'../node_modules/@aws-amplify/auth/node_modules/amazon-cognito-identity-js/android' can vary depending on your aws-amplify version. Go to the folder and find the correct path

Strange. When I run react-native link amazon-cognito-identity-js, I got this error:
error EPERM: operation not permitted, scandir 'D:\myapp\android\app\build\intermediates\signing_config\debug\out\signing-config.json'

what happen?

Was this page helpful?
0 / 5 - 0 ratings