Amplify-cli: Add Analytics Pinpoint Function Fails

Created on 19 Dec 2018  ·  12Comments  ·  Source: aws-amplify/amplify-cli

Add Analytics Pinpoint Function Fails

The CLI hangs for a long time, the lambda function gives this error in the cloudwatch logs:

module initialization error: ReferenceError
at Object. (/var/task/index.js:3:71)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)

analytics investigating

All 12 comments

@ryanmdd Thanks, we found the bug already and it's been fixed by the PR #606
It will be in the production release by the end of the day.

This is still an issue, even with 0.1.38. Create hangs for about 1h then CloudFormation reports an error like " The following resource(s) failed to create: [PinpointFunctionOutputs]."

@mihaiblaga89 Thanks for the feedbacks, we are not able to reproduce this issue with the latest version 0.1.38 though, it does take a little while to create.
In my personal case, it took a little over two minutes to create both analytics and its associated auth.

In what region did you create your backend resources?
Analytics uses Pinpoint, which used to be only available in the 'us-east-1', now it's available in two other regions, so the cli maps the project's backend region to a nearest Pinpoint region to create the Pinpoint project.

It might also be a npm cache problem, you can try to remove all the amply-cli packages first, and then do a fresh installation with npm install -g @aws-amplify/cli@latest, see if that works.

I wait about 30 mins trying to create, then it fails and another 30 for it to be rolled back. Region is us-west-2. Tried the update but no avail. It's a new project and I'm trying to push both Auth and Analytics.

Just tried it step by step. Add Auth first, then Analytics and it worked. For some reason pushing them both will not.

This issue should be fixed with the latest version of the CLI. Feel free to re-open if the issue still persists.

not fixed still.. super buggy evenwith version 1.51 :(

I'm still encountering this issue. If I run amplify add analytics locally and try to push, it hangs for about 60 - 90 minutes and then I get an error message. My amplify cloud project is in eu-central-1. Any leads on this?

having this issue too, at version 1.6.11. seems new. probably can't use amplify on the current project at this rate.

@imwm & @SebastianKirsch123 Which version of the CLI are you using and what's the error are you getting? I was able to add analytics via amplify add analytics command and then successfully amplify push. Here's a screenshot of the commands:

f45c89966b0d:analyticstest kaustavg$ amplify -v 
1.6.11
f45c89966b0d:analytictest kaustavg$ amplify add analytics
Using service: Pinpoint, provided by: awscloudformation
? Provide your pinpoint resource name: analytictest
Adding analytics would add the Auth category to the project if not already added.
? Apps need authorization to send analytics events. Do you want to allow guests and unauthenticated users to send analytics events?
 (we recommend you allow this when getting started) Yes
Successfully added auth resource locally.
Successfully added resource analytictest locally

Some next steps:
"amplify push" builds all of your local backend resources and provisions them in the cloud
"amplify publish" builds all your local backend and front-end resources (if you have hosting category added) and provisions them in the cloud

f45c89966b0d:analytictest kaustavg$ amplify push

Current Environment: dev

| Category  | Resource name   | Operation | Provider plugin   |
| --------- | --------------- | --------- | ----------------- |
| Auth      | cognitoa6127c55 | Create    | awscloudformation |
| Analytics | analytictest    | Create    | awscloudformation |
? Are you sure you want to continue? Yes
⠏ Updating resources in the cloud. This may take a few minutes...

UPDATE_IN_PROGRESS analytictest-dev-20190528191019 AWS::CloudFormation::Stack Tue May 28 2019 19:12:44 GMT-0700 (PDT) User Initiated
CREATE_IN_PROGRESS authcognitoa6127c55             AWS::CloudFormation::Stack Tue May 28 2019 19:12:49 GMT-0700 (PDT)               
CREATE_IN_PROGRESS analyticsanalytictest           AWS::CloudFormation::Stack Tue May 28 2019 19:12:49 GMT-0700 (PDT)               
⠇ Updating resources in the cloud. This may take a few minutes...

CREATE_IN_PROGRESS authcognitoa6127c55   AWS::CloudFormation::Stack Tue May 28 2019 19:12:50 GMT-0700 (PDT) Resource creation Initiated
CREATE_IN_PROGRESS analyticsanalytictest AWS::CloudFormation::Stack Tue May 28 2019 19:12:50 GMT-0700 (PDT) Resource creation Initiated
⠙ Updating resources in the cloud. This may take a few minutes...

CREATE_IN_PROGRESS analytictest-dev-20190528191019-analyticsanalytictest-19LWX6M47RJ4W AWS::CloudFormation::Stack Tue May 28 2019 19:12:50 GMT-0700 (PDT) User Initiated
⠸ Updating resources in the cloud. This may take a few minutes...

CREATE_IN_PROGRESS analytictest-dev-20190528191019-authcognitoa6127c55-1QXWGG7PMPKGR AWS::CloudFormation::Stack Tue May 28 2019 19:12:50 GMT-0700 (PDT) User Initiated
⠹ Updating resources in the cloud. This may take a few minutes...

CREATE_IN_PROGRESS LambdaExecutionRole AWS::IAM::Role Tue May 28 2019 19:12:54 GMT-0700 (PDT)                            
CREATE_IN_PROGRESS LambdaExecutionRole AWS::IAM::Role Tue May 28 2019 19:12:55 GMT-0700 (PDT) Resource creation Initiated
⠼ Updating resources in the cloud. This may take a few minutes...

CREATE_IN_PROGRESS IdentityPool AWS::Cognito::IdentityPool Tue May 28 2019 19:12:55 GMT-0700 (PDT) 
⠧ Updating resources in the cloud. This may take a few minutes...

CREATE_IN_PROGRESS IdentityPool AWS::Cognito::IdentityPool Tue May 28 2019 19:12:57 GMT-0700 (PDT) Resource creation Initiated
CREATE_COMPLETE    IdentityPool AWS::Cognito::IdentityPool Tue May 28 2019 19:12:58 GMT-0700 (PDT)                            
⠇ Updating resources in the cloud. This may take a few minutes...

CREATE_IN_PROGRESS IdentityPoolRoleMap AWS::Cognito::IdentityPoolRoleAttachment Tue May 28 2019 19:13:02 GMT-0700 (PDT)                            
CREATE_IN_PROGRESS IdentityPoolRoleMap AWS::Cognito::IdentityPoolRoleAttachment Tue May 28 2019 19:13:04 GMT-0700 (PDT) Resource creation Initiated
CREATE_COMPLETE    IdentityPoolRoleMap AWS::Cognito::IdentityPoolRoleAttachment Tue May 28 2019 19:13:04 GMT-0700 (PDT)                            
⠧ Updating resources in the cloud. This may take a few minutes...

CREATE_COMPLETE LambdaExecutionRole AWS::IAM::Role Tue May 28 2019 19:13:06 GMT-0700 (PDT) 
⠏ Updating resources in the cloud. This may take a few minutes...

CREATE_COMPLETE analytictest-dev-20190528191019-authcognitoa6127c55-1QXWGG7PMPKGR AWS::CloudFormation::Stack Tue May 28 2019 19:13:06 GMT-0700 (PDT) 
⠹ Updating resources in the cloud. This may take a few minutes...

CREATE_IN_PROGRESS PinpointFunction AWS::Lambda::Function Tue May 28 2019 19:13:09 GMT-0700 (PDT)                            
CREATE_IN_PROGRESS PinpointFunction AWS::Lambda::Function Tue May 28 2019 19:13:09 GMT-0700 (PDT) Resource creation Initiated
CREATE_COMPLETE    PinpointFunction AWS::Lambda::Function Tue May 28 2019 19:13:09 GMT-0700 (PDT)                            
⠇ Updating resources in the cloud. This may take a few minutes...

CREATE_COMPLETE authcognitoa6127c55 AWS::CloudFormation::Stack Tue May 28 2019 19:13:12 GMT-0700 (PDT) 
⠧ Updating resources in the cloud. This may take a few minutes...

CREATE_IN_PROGRESS PinpointFunctionOutputs Custom::LambdaCallout Tue May 28 2019 19:13:12 GMT-0700 (PDT) 
⠹ Updating resources in the cloud. This may take a few minutes...

CREATE_IN_PROGRESS PinpointFunctionOutputs Custom::LambdaCallout Tue May 28 2019 19:13:16 GMT-0700 (PDT) Resource creation Initiated
CREATE_COMPLETE    PinpointFunctionOutputs Custom::LambdaCallout Tue May 28 2019 19:13:16 GMT-0700 (PDT)                            
⠸ Updating resources in the cloud. This may take a few minutes...

CREATE_IN_PROGRESS CognitoAuthPolicy   AWS::IAM::Policy Tue May 28 2019 19:13:19 GMT-0700 (PDT)                            
CREATE_IN_PROGRESS CognitoUnauthPolicy AWS::IAM::Policy Tue May 28 2019 19:13:19 GMT-0700 (PDT)                            
CREATE_IN_PROGRESS CognitoAuthPolicy   AWS::IAM::Policy Tue May 28 2019 19:13:20 GMT-0700 (PDT) Resource creation Initiated
CREATE_IN_PROGRESS CognitoUnauthPolicy AWS::IAM::Policy Tue May 28 2019 19:13:20 GMT-0700 (PDT) Resource creation Initiated
⠋ Updating resources in the cloud. This may take a few minutes...

CREATE_COMPLETE CognitoAuthPolicy                                                   AWS::IAM::Policy           Tue May 28 2019 19:13:28 GMT-0700 (PDT) 
CREATE_COMPLETE CognitoUnauthPolicy                                                 AWS::IAM::Policy           Tue May 28 2019 19:13:28 GMT-0700 (PDT) 
CREATE_COMPLETE analytictest-dev-20190528191019-analyticsanalytictest-19LWX6M47RJ4W AWS::CloudFormation::Stack Tue May 28 2019 19:13:30 GMT-0700 (PDT) 
⠋ Updating resources in the cloud. This may take a few minutes...

CREATE_COMPLETE analyticsanalytictest AWS::CloudFormation::Stack Tue May 28 2019 19:13:37 GMT-0700 (PDT) 
⠙ Updating resources in the cloud. This may take a few minutes...

UPDATE_COMPLETE_CLEANUP_IN_PROGRESS analytictest-dev-20190528191019 AWS::CloudFormation::Stack Tue May 28 2019 19:13:40 GMT-0700 (PDT) 
⠙ Updating resources in the cloud. This may take a few minutes...

UPDATE_COMPLETE analytictest-dev-20190528191019 AWS::CloudFormation::Stack Tue May 28 2019 19:13:41 GMT-0700 (PDT) 
✔ All resources are updated in the cloud

Pinpoint URL to track events https://eu-west-1.console.aws.amazon.com/pinpoint/home/?region=eu-west-1#/apps/927ed25c166d4f0f8ced914f3673e5bd/analytics/overview

f45c89966b0d:analytictest kaustavg$  





@imwm It would be really helpful for us to know what the exact error message is that you're getting, which version of the CLI you're using and which region you have your project in, to further root-cause your issue.

ah, i got it. looks like you still need to apply this analytics migration even at amplify-cli version 1.7.0: https://aws-amplify.github.io/docs/cli/lambda-node-version-update#auth

Was this page helpful?
0 / 5 - 0 ratings