when i deploy my image resizing code with: sls deploy --stage acc --bucket mybucketname --verbose
I get: CloudFormation - CREATE_FAILED - Custom::S3 - ImageResizeCustomS31
… An error occurred: ImageResizeCustomS31 - Failed to create resource. Unable to validate the following destination configurations
EDIT : I found the solution in Github. You need to delete your events and recreate them. I did that and now it works fine. I hope it can help.
Here is my code :
service: ultima-api
# app and org for use with dashboard.serverless.com
app: ultima-api
org: xxx
# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
# frameworkVersion: "=X.X.X"
provider:
name: aws
runtime: nodejs12.x
stage: ${opt:stage, 'dev'}
region: us-east-1
memorySize: 512
timeout: 180
iamManagedPolicies:
- "arn:aws:iam::xxx:policy/BcnUltima"
environment:
TEST: ${self:custom.${self:provider.stage}.s3-temp-bucket}
functions:
onS3UnzipToS3:
handler: src/handler.onS3UnzipToS3
events:
- s3:
bucket: ${self:custom.${self:provider.stage}.s3-temp-bucket}
existing: true
plugins:
- serverless-plugin-typescript
- serverless-offline
custom:
prod:
s3-temp-bucket: mybucket-prod
dev:
s3-temp-bucket: mybucket-dev