Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Cannot read property 'ddb' of undefined #138

Open
aaaguirrep opened this issue Apr 15, 2018 · 1 comment
Open

Cannot read property 'ddb' of undefined #138

aaaguirrep opened this issue Apr 15, 2018 · 1 comment

Comments

@aaaguirrep
Copy link

Hi, it is a good example of how to use aws cognito to users manage, I am beginning in the programming world and I am learning. I have tested the code and it is showing an issue in the console about "Cannot read property 'ddb' of undefined". I checked that it refers to aws.service.ts file and the line 95, there is a variable called ddb used. How and where should it be declared to remove the issue?

I have tried different ways and the issue doesn't disappear.

Thanks in advance.

I copy where the var is used.

addCognitoCredentials(idTokenJwt: string): void {
let creds = this.cognitoUtil.buildCognitoCreds(idTokenJwt);

    AWS.config.credentials = creds;

    creds.get(function (err) {
        if (!err) {
            if (AwsUtil.firstLogin) {
                // save the login info to DDB
                this.ddb.writeLogEntry("login");
                AwsUtil.firstLogin = false;
            }
        }
    });
}
@aaaguirrep
Copy link
Author

More information, the issue occurs when:
-Login in the app
-Close the tap
-Open the app and it appears in the console.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant