amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

amplify add pinpoint - There was an error adding the analytics resource

Open dotto95 opened this issue 1 year ago • 3 comments

How did you install the Amplify CLI?

yarn

If applicable, what version of Node.js are you using?

18.16.0

Amplify CLI Version

12.8.1

What operating system are you using?

Windows 11

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No manual changes made

Describe the bug

After amplify pull --appId xxxxx --envName prod

amplify analytics add --debug Output:

? Select an Analytics provider Amazon Pinpoint √ Provide your pinpoint resource name: · appui ConfigurationError: The imported auth config is not compatible with the specified analytics config at configure (C:\snapshot\amplify-cli\build\node_modules@aws-amplify\amplify-category-analytics\lib\provider-utils\awscloudformation\service-walkthroughs\pinpoint-walkthrough.js:61:11) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.executeAmplifyCommand (C:\snapshot\amplify-cli\build\node_modules@aws-amplify\amplify-category-analytics\lib\index.js:169:3) at async executePluginModuleCommand (C:\snapshot\amplify-cli\build\node_modules@aws-amplify\cli-internal\lib\execution-manager.js:139:5) at async executeCommand (C:\snapshot\amplify-cli\build\node_modules@aws-amplify\cli-internal\lib\execution-manager.js:37:9) at async Object.run (C:\snapshot\amplify-cli\build\node_modules@aws-amplify\cli-internal\lib\index.js:121:5) 🛑 There was an error adding the analytics resource

I read that: https://github.com/aws-amplify/amplify-cli/issues/13240 but after enabled guest doesn't work (i didn't found unauthenticated users feature):

image

Expected behavior

add pinpoint

Reproduction steps

  1. launch "amplify add pinpoint"

Project Identifier

No response

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • [X] I have removed any sensitive information from my code snippets and submission.

dotto95 avatar Feb 15 '24 17:02 dotto95

Hey @dotto95, thank you for reaching out. Tried reproducing the issue with the following steps and latest Amplify CLI version.

  1. created a new user pool with app client and sample providers

Screenshot 2024-02-15 at 12 53 17 PM

Screenshot 2024-02-15 at 12 53 56 PM

  1. created an identity pool with guest access and Authenticated access enabled. Authenticated identity source as Cognito user pool Screenshot 2024-02-15 at 12 45 02 PM

  2. amplify import auth -> Cognito User Pool and Identity Pool

  3. amplify add analytics -> Pinpoint the analytics resource was successfully added. Does the reproduction steps align with your current environment?

ykethan avatar Feb 15 '24 17:02 ykethan

Hey there,

Thank you for the detailed walkthrough. The steps you've described do align with my environment, and the analytics resource was added successfully.

However, I'm looking to integrate this with my existing Cognito user pool, where I already have users registered. As you can see in the screenshots, I've also enabled guest users.

image

During my testing, I encountered an error when using the amplify pull command.


 amplify pull --appId yyyyyyyyyyyyyyyyyy--envName xxxxxxxxxxxxxx --debug
Opening link: https://eu-central-1.admin.amplifyapp.com/admin/xxxxxxxxxxxxxx/prodrest/verify/?loginVersion=1
⠋ Confirm login in the browser or manually paste in your CLI login key:
Successfully received Amplify Studio tokens.                                                                                                                           
Amplify AppID found: xxxxxxxxxxxxxx. Amplify App name is: appui
Backend environment prodrest found in Amplify Console app: appui
? Choose your default editor: Visual Studio Code
√ Choose the type of app that you're building · javascript
Please tell us about your project
? What javascript framework are you using react
? Source Directory Path:  src
? Distribution Directory Path: build
? Build Command:  yarn build
? Start Command: yarn start
No AppSync API configured. Please add an API
TypeError: Cannot read properties of undefined (reading 'length')
Skipping UI component generation since none are found.
? Do you plan on modifying this backend? Yes
/ Fetching updates to backend environment: prodrest from the cloud.Overrides functionality is not implemented for this category
√ Successfully pulled backend environment prodrest from the cloud.
✅ 

✅ Successfully pulled backend environment prodrest from the cloud.
Run 'amplify pull' to sync future upstream changes.

No AppSync API configured. Please add an API
TypeError: Cannot read properties of undefined (reading 'length')
Skipping UI component generation since none are found.

Could you provide guidance on how to integrate Amplify with an existing Cognito user pool and resolve the issue encountered with amplify pull?

Thanks in advance for your assistance.

dotto95 avatar Feb 15 '24 21:02 dotto95

Hey @dotto95, curious when running amplify import auth are you importing both the user pool and identity pool? you should be able to import the existing user pool and the identity pool. Diving the code here: https://github.com/aws-amplify/amplify-cli/blob/52aea18fddd95af6f855d1c6d9e3e4b16a8d1146/packages/amplify-category-analytics/src/provider-utils/awscloudformation/service-walkthroughs/pinpoint-walkthrough.ts#L65 the resource check if the project has an identity pool and unauthenticated access enabled.

ykethan avatar Feb 17 '24 02:02 ykethan

Closing the issue due to inactivity. Do reach out to us if you require any assistance.

ykethan avatar May 03 '24 15:05 ykethan

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.

github-actions[bot] avatar May 03 '24 15:05 github-actions[bot]