amplify-cli: Storage update to add Trigger

Describe the bug When trying to add a Lambda Trigger to the Storage category to an existing Bucket, generated through the CLI, the cloudformation update fails with:

Unable to validate the following destination configurations (Service: Amazon S3; Status Code: 400; Error Code: InvalidArgument; ...)

Amplify CLI Version 4.12.0

To Reproduce

amplify update storage
? Please select from one of the below mentioned services: Content (Images, audio, video, etc.)
? Who should have access: Auth and guest users
? What kind of access do you want for Authenticated users? (Press <space> to select, <a> to toggle all, <i> to invert selection)read
? What kind of access do you want for Guest users? (Press <space> to select, <a> to toggle all, <i> to invert selection)read
? Do you want to add a Lambda Trigger for your S3 Bucket? Yes
? Select from the following options Create a new function
Successfully added resource S3Trigger425e293d locally
? Do you want to edit the local S3Trigger425e293d lambda function now? No
Successfully updated resource
amplify push

| Category | Resource name             | Operation | Provider plugin   |
| -------- | ------------------------- | --------- | ----------------- |
| Function | S3Trigger425e293d         | Create    | awscloudformation |
| Storage  | RenToStorage              | Update    | awscloudformation |

This results in the following error:

UPDATE_FAILED               S3Bucket                                                   AWS::S3::Bucket            Tue Jan 14 2020 11:37:53 GMT+0100 (GMT+01:00) Unable to validate the following destination configurations (Service: Amazon S3; Status Code: 400; Error Code: InvalidArgument; Request ID: 067DFD7D99E0C783; S3 Extended Request ID: eW2csxhTfjUd3Rz5+AXeeObnAtpksDBX3uKyHq7qg1Dyj2kqnlZsfu/m93U/vQs8W96P5fy1M04=)
UPDATE_IN_PROGRESS          S3Bucket                                                   AWS::S3::Bucket            Tue Jan 14 2020 11:37:52 GMT+0100 (GMT+01:00)




UPDATE_FAILED storageRenToStorage AWS::CloudFormation::Stack Tue Jan 14 2020 11:37:55 GMT+0100 (GMT+01:00) Embedded stack arn:aws:cloudformation:eu-central-1:124149422162:stack/rento-dev-20190818200122-storageRenToStorage-1TK3A4S344829/fad0f590-ca7a-11e9-a2e9-0a43c0b04aee was not successfully updated. Currently in UPDATE_ROLLBACK_IN_PROGRESS with reason: The following resource(s) failed to update: [S3Bucket].
- Updating resources in the cloud. This may take a few minutes...

Expected behavior The Lambda Trigger is created and added to the S3 Bucket

Desktop (please complete the following information):

  • OS: [Windows]
  • Node Version: v12.14.1

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

There was a problem with the name generated by my previous stack for AWS:S3:Bucket, I’ve just added following code to solve the problem: "Properties": { "BucketName": { "Fn::If": [ "ShouldNotCreateEnvResources", { "Ref": "bucketName" }, { "Fn::Join": [ "", [ { "Ref": "bucketName" }, { "Fn::Select": [ 3, { "Fn::Split": [ "-", { "Ref": "AWS::StackName" } ] } ] }, "-", { "Ref": "env" } ] ] } ] },