amazon-archives / aws-cognito-angular-quickstart

An Angular(v5)-based QuickStart single-page app utilizing Amazon Cognito, S3, and DynamoDB (Serverless architecture)
https://cognito.budilov.com
Apache License 2.0
689 stars 304 forks source link

mobileanalytics resource configuration issue? #40

Closed coldcam closed 7 years ago

coldcam commented 7 years ago

Since I'm a total newbie on this kind of programming, the following may be completely unfounded. However, when I attempted to rebuild the code for the us-west-2 region, I discovered a recurring error in the setupAWS function when referencing the mobileanalytics app_ID:

        // Setup mobile analytics
        var options = {
            appId: '32673c035a0b40e99d6e1f327be0cb60',
            appTitle: "aws-cognito-angular2-quickstart"
        };

I didn't think my account would have access to this appid, so I first tried to create my own, but discovered I could not set it up to use the correct identity pool. Then I discovered mobileanalytics was only offered in us-east-1... so I moved everything back to us-east-1 and created a new MA app. The error has gone away, although I confess my understanding of what is going on may be fundamentally flawed.

On a side note I saw the error mentioned above: Failed to load resource: net::ERR_NAME_NOT_RESOLVED https://mobileanalytics.us-west-2.amazonaws.com/2014-06-05/events

over and over again indicating the code kept retrying, true? Is this an aspect of Angular2?

Oh well, feel free to close this issue... I'm just happy to get some informative clarifications.

vbudilov commented 7 years ago

Hi @coldcam,

I'm not sure what the actual question is :)

Vladimir

coldcam commented 7 years ago

Hi @vbudilov,

a. does the code in setup.AWS (referenced in my 1st post) need to be modified manually for our own appID and title? or can this app reference the currently hard-coded appID and title? When I changed the code to reference my own appid and title, I got rid of a recurring error when running this function so I assume this is the case, however, it would appear to break the model of using the createResources.sh script to generate these user-specific resources.

b. Since mobileanaytics is currently offered only in us-east-1 does this impose limitations on what region we can set in the environment file? Since identity pools are region specific this would appear to limit us to running in us-east-1 where mobileanalytics is available.

c. when a function like "new AMA.Manager(options);" fails in an angular2 app, it appears to keep retrying. is this true? I kept getting the error over and over which is why I assume it works this way, but since this is my first angular2 app, I simply don't know.

Thanks for reading! Hopefully this helps clarify my questions and points of confusion.

vbudilov commented 7 years ago
  1. Yes, you need to modify these values yourself for now. createResource doesn't do it for you
  2. You don't need mobileanalytics to use Cognito user pools or Cognito federated identities.
  3. Some of our SDKs have retry policies embedded in them for resiliency. I haven't dived deep into the AMA SDK, but that must be the case here if you're noticing a retry call.
coldcam commented 7 years ago

Thanks @vbudilov ,

Perhaps then the bit of code in aws.service.ts which sets up mobileanalytics is superfluous to the functioning of this app and consequently we wouldn't need to update these values if the code were not there in the first place. True?

vbudilov commented 7 years ago

@coldcam, adding the mobileanalytics code demonstrates how to call it and use it. I will update the environment files to pull in the property values from there. Good feedback!

coldcam commented 7 years ago

Good Point. I will go ahead and close.