Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update/delete of notifications on newly created environment yields in errors #13778

Open
2 tasks done
charithreddyv opened this issue May 13, 2024 · 3 comments
Open
2 tasks done
Labels
bug Something isn't working multienv Issues tied to multiple environment feature in the CLI notifications Issues tied to the notifications category p2

Comments

@charithreddyv
Copy link

How did you install the Amplify CLI?

No response

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

No response

Amplify CLI Version

12.10.1

What operating system are you using?

Mac

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

I have created a new environment names 'staging' add Auth, Function, Analytics and Notifications (pinpoint APNS for now ) that was successful .
i did amplify env add and named the new one prod everything was success except for notification
When i run amplify status all resources shows 'No Change' but Notifications shows 'Create' ,
When i run amplify add notification or amplify update notification and selected the channel as APNS or FCM it yields the following error

✔ Choose the notification channel to enable · APNS |  Apple Push Notifications   
🛑 Cannot read properties of undefined (reading 'replace')

Resolution: Please report this issue at https://github.com/aws-amplify/amplify-cli/issues and include the project identifier from: 'amplify diagnose --send-report'
Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

UnknownFault: Cannot read properties of undefined (reading 'replace')
    at genericErrorToAmplifyException (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/amplify-exception-handler.js:126:49)
    at handleException (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/amplify-exception-handler.js:27:28)
    at process.<anonymous> (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/index.js:52:93)
    at process.emit (node:events:513:28)
    at process._fatalException (node:internal/process/execution:149:25)

Cannot read properties of undefined (reading 'replace')
TypeError: Cannot read properties of undefined (reading 'replace')
    at PinpointName.extractResourceName (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-notifications/lib/pinpoint-name.js:7:82)
    at scanCategoryMetaForPinpoint (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-notifications/lib/pinpoint-helper.js:296:80)
    at getPinpointAppStatusNotifications (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-notifications/lib/pinpoint-helper.js:101:51)
    at getPinpointAppStatus (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-notifications/lib/pinpoint-helper.js:122:84)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ensurePinpointApp (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-notifications/lib/pinpoint-helper.js:206:45)
    at async Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-notifications/lib/commands/notifications/add.js:44:114)
    at async Object.executeAmplifyCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-category-notifications/lib/index.js:62:5)
    at async executePluginModuleCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:139:5)
    at async executeCommand (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:37:9)
    at async Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/cli-internal/lib/index.js:121:5)

Session Identifier: 7669723c-81f1-4f41-85a5-81ff7c53c221

✅ Report saved: /var/folders/s0/mnwl9h99021dvthf1w0hz9tr0000gn/T/elovuMOMsApp/report-1715595641860.zip

✔ Done

Project Identifier: 30c6d7ea108cb6bcc4017c50672ccfd5

I just recognised Pinpoint is not available on us-west-1 but my staging env was also configured on us-west-1

Expected behavior

Should be able to update certs for APNS and FCM and amplify push to use resources.

Reproduction steps

  1. Create a environment from existing environment and do amplify push.

Project Identifier

Project Identifier: 30c6d7ea108cb6bcc4017c50672ccfd5

Log output

# Put your logs below this line
2024-05-13T10:06:42.781Z|error : Could not initialize categories for 'prod': Cannot read properties of undefined (reading 'replace')
ProjectInitFault: Could not initialize categories for 'prod': Cannot read properties of undefined (reading 'replace')
2024-05-13T10:06:49.562Z|info : amplify pull core  {"debug":true,"yes":false}
2024-05-13T10:06:49.615Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2024-05-13T10:06:52.909Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["elovu-us-west-1-production"])
2024-05-13T10:06:52.911Z|info : amplify-provider-awscloudformation.system-config-manager.getProfiledAwsConfig.profileConfig([{"region":"us-west-1"}])
2024-05-13T10:06:52.912Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileCredentials(["elovu-us-west-1-production"])
2024-05-13T10:06:52.937Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["elovu-us-west-1-production"])
2024-05-13T10:06:52.938Z|info : amplify-provider-awscloudformation.system-config-manager.getProfiledAwsConfig.profileConfig([{"region":"us-west-1"}])
2024-05-13T10:06:52.939Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileCredentials(["elovu-us-west-1-production"])
2024-05-13T10:06:52.946Z|info : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null])
2024-05-13T10:06:52.948Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]msapp-[***]od-[***]942-[***]ment"}])
2024-05-13T10:06:54.719Z|info : amplify-provider-awscloudformation.initialize-env.run.cfn.updateamplifyMetaFileWithStackOutputs([{"StackName":"[***]ify-[***]msapp-[***]od-[***]942"}])
2024-05-13T10:06:54.726Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["elovu-us-west-1-production"])
2024-05-13T10:06:54.732Z|info : amplify-provider-awscloudformation.system-config-manager.getProfiledAwsConfig.profileConfig([{"region":"us-west-1"}])
2024-05-13T10:06:54.732Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileCredentials(["elovu-us-west-1-production"])
2024-05-13T10:06:54.811Z|info : amplify-provider-awscloudformation.aws-cfn.updateamplifyMetaFileWithStackOutputs.cfn.listStackResources([{"StackName":"[***]ify-[***]msapp-[***]od-[***]942"}])
2024-05-13T10:06:56.403Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]ify-[***]msapp-[***]od-[***]942"}])
2024-05-13T10:06:58.380Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:us-[***]st-[***]40:stack/[***]ify-[***]msapp-[***]od-[***]942-[***]mLambdaStack-[***]4NTPWD/[***]a8c0-[***]0d-[***]ef-[***]57-[***]ee943"}])
2024-05-13T10:06:58.388Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:us-[***]st-[***]40:stack/[***]ify-[***]msapp-[***]od-[***]942-[***]vumomsapp-[***]4967H/[***]94c0-[***]0d-[***]ef-[***]31-[***]cbc79"}])
2024-05-13T10:06:58.392Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:us-[***]st-[***]40:stack/[***]ify-[***]msapp-[***]od-[***]942-[***]sAuth-[***]RMKO6/[***]cf50-[***]0d-[***]ef-[***]61-[***]0fc3b"}])
2024-05-13T10:06:58.394Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:us-[***]st-[***]40:stack/[***]ify-[***]msapp-[***]od-[***]942-[***]olGroups-[***]D8C6YF/[***]5190-[***]0d-[***]ef-[***]5c-[***]69d89"}])
2024-05-13T10:06:58.397Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:us-[***]st-[***]40:stack/[***]ify-[***]msapp-[***]od-[***]942-[***]tConfirmation-[***]X7QMLK/[***]72c0-[***]0d-[***]ef-[***]02-[***]2448f"}])
2024-05-13T10:07:00.249Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]ify-[***]json","Bucket":"[***]ify-[***]msapp-[***]od-[***]942-[***]ment"}])
2024-05-13T10:07:01.565Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["elovu-us-west-1-production"])
2024-05-13T10:07:01.568Z|info : amplify-provider-awscloudformation.system-config-manager.getProfiledAwsConfig.profileConfig([{"region":"us-west-1"}])
2024-05-13T10:07:01.568Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileCredentials(["elovu-us-west-1-production"])
2024-05-13T10:07:05.230Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["elovu-us-west-1-production"])
2024-05-13T10:07:05.232Z|info : amplify-provider-awscloudformation.system-config-manager.getProfiledAwsConfig.profileConfig([{"region":"us-west-1"}])
2024-05-13T10:07:05.232Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileCredentials(["elovu-us-west-1-production"])
2024-05-13T10:07:05.240Z|info : amplify-provider-awscloudformation.CognitoUserPoolService.listUserPool.cognito.listUserPools([{"params":{"MaxResults":60}}])
2024-05-13T10:07:06.187Z|info : amplify-provider-awscloudformation.CognitoUserPoolService.listUserPoolIdentityProviders.cognito.listIdentityProviders([{"UserPoolId":"[***]s-[***]st-[***]JafQk","MaxResults":60}])
2024-05-13T10:07:07.845Z|error : Could not initialize categories for 'prod': Cannot read properties of undefined (reading 'replace')
ProjectInitFault: Could not initialize categories for 'prod': Cannot read properties of undefined (reading 'replace')
2024-05-13T10:08:33.475Z|info : amplify help core Analytics 
2024-05-13T10:08:49.002Z|info : amplify remove analytics  
2024-05-13T10:08:49.079Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2024-05-13T10:08:53.830Z|error : Analytics resource elovumomsapp is being used by the notifications category and cannot be removed
ResourceInUseError: Analytics resource elovumomsapp is being used by the notifications category and cannot be removed
2024-05-13T10:09:08.095Z|info : amplify remove notifications  
2024-05-13T10:09:08.171Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2024-05-13T10:09:17.764Z|error : Cannot read properties of undefined (reading 'replace')
UnknownFault: Cannot read properties of undefined (reading 'replace')
2024-05-13T10:09:24.276Z|info : amplify remove notifications  {"force":true,"yes":false}
2024-05-13T10:09:24.355Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2024-05-13T10:09:30.690Z|error : Cannot read properties of undefined (reading 'replace')
UnknownFault: Cannot read properties of undefined (reading 'replace')
2024-05-13T10:16:00.316Z|info : amplify add notification  
2024-05-13T10:16:00.395Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2024-05-13T10:16:06.302Z|error : Cannot read properties of undefined (reading 'replace')
UnknownFault: Cannot read properties of undefined (reading 'replace')
2024-05-13T10:17:24.570Z|info : amplify version core  
2024-05-13T10:20:37.909Z|info : amplify add notification  {"debug":true,"yes":false}
2024-05-13T10:20:37.988Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2024-05-13T10:20:44.929Z|error : Cannot read properties of undefined (reading 'replace')
UnknownFault: Cannot read properties of undefined (reading 'replace')
2024-05-13T10:23:39.185Z|info : amplify diagnose core  {"send-report":true,"yes":false}
2024-05-13T10:23:39.263Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}

Additional information

No response

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@charithreddyv charithreddyv added the pending-triage Issue is pending triage label May 13, 2024
@charithreddyv
Copy link
Author

from amplify/backend/analytics/elovumomsapp/pinpoint-cloudformation-template.json

    "RegionMapping": {
      "us-east-1": {
        "pinpointRegion": "us-east-1"
      },
      "us-east-2": {
        "pinpointRegion": "us-east-2"
      },
      "sa-east-1": {
        "pinpointRegion": "us-east-1"
      },
      "ca-central-1": {
        "pinpointRegion": "ca-central-1"
      },
      "us-west-1": {
        "pinpointRegion": "us-west-2"
      },
      "us-west-2": {
        "pinpointRegion": "us-west-2"
      },...

i understand Pinpoint configured on us-west-1 are mapped to us-west-2 and i can see both staging and prod project there but prod one is not yet enabled
Screenshot 2024-05-13 at 4 31 15 PM

@ykethan
Copy link
Member

ykethan commented May 22, 2024

Hey @charithreddyv, thank you for reaching out. Could you provide us a snippet of the notifications and analytics block from amplify-meta.json file.
Does removing and re-adding the notifications resource mitigate the behavior?

@ykethan ykethan added notifications Issues tied to the notifications category pending-response Issue is pending response from the issue author labels May 22, 2024
@ykethan
Copy link
Member

ykethan commented Jun 28, 2024

Was able to reproduce the error, marking as bug

Steps to reproduce:

  1. amplify init
  2. amplify add auth -> with social providers
  3. amplify add notifications
  4. amplify push
  5. amplify add env, this auto pushes the auth resource and fails with The provider Google does not exist for User Pool <user-pool-id>
    workaround: once the push completes and fails run amplify update auth -> select Update OAuth social providers and re-input the credentials.
  6. then run amplify push
  7. Running amplify pull or other commands after the push causes Cannot read properties of undefined (reading 'replace')
    workaround: run amplify env checkout <existing-env-name>

@ykethan ykethan added bug Something isn't working p2 multienv Issues tied to multiple environment feature in the CLI and removed pending-response Issue is pending response from the issue author pending-triage Issue is pending triage labels Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working multienv Issues tied to multiple environment feature in the CLI notifications Issues tied to the notifications category p2
Projects
None yet
Development

No branches or pull requests

2 participants