sodaru / aws-cognito-srp-client

SRP Client for AWS Cognito in Javascript
MIT License
1 stars 1 forks source link

The package throws error on invocation #1

Closed sumitbhowmick closed 1 year ago

sumitbhowmick commented 1 year ago

I tried to use the library as demonstrated. const {Srp} = require('aws-cognito-srp-client'); const identityPoolId = "us-east-1_xYZZcH2" const srp = new Srp(identityPoolId); const srpA = srp.getA();

It throws following error.

ERROR Invoke Error { "errorType": "TypeError", "errorMessage": "Srp is not a constructor", "stack": [ "TypeError: Srp is not a constructor", " at Runtime.exports.login [as handler] (/var/task/cognitoUtil.js:11:15)", " at Runtime.handleOnceNonStreaming (file:///var/runtime/index.mjs:1085:29)" ] }

Raaghu commented 1 year ago

The Srp is a default export

Use this const Srp = require('aws-cognito-srp-client'); instead of const {Srp} = require('aws-cognito-srp-client');