首页 > 解决方案 > 在 s3 事件上使用“existing: true”会引发“无法验证以下目标配置”

问题描述

我们曾经在我们的函数中使用参数existing: true将事件通知附加到我们的 S3 存储桶。但是现在当我尝试使用此参数部署新堆栈时,出现以下错误:

An error occurred: EventDashs3CustomS31 - Received response status [FAILED] from custom resource. Message returned: Unable to validate the following destination configurations See details in CloudWatch Log: 2021/07/01/[$LATEST]f75aa563de5a4bfba7648d2369650888 (RequestId: 6fd0e4db-f0b2-4b4f-ba91-d76eeb1fb888).

无服务器配置:

environment:
    BUCKET_UPLOAD_CSV: my_upload_bucket
  iamRoleStatements:
    - Effect: Allow
      Action:
        - s3:ListBucket
        - s3:PutObject
        - s3:GetObject
        - s3:DeleteObject
        - "s3:GetBucketNotification"
        - "s3:PutBucketNotification"
      Resource: "arn:aws:s3:::${self:provider.environment.BUCKET_UPLOAD_CSV}/*"

functions:
  event-s3:
    runtime: nodejs14.x
    handler: index.handler
    tags: ${self:custom.tags}
    timeout: 900
    memorySize: 128
    events:
      - s3:
          bucket: ${self:provider.environment.BUCKET_UPLOAD_CSV}
          event: s3:ObjectCreated:*
          existing: true
          rules:
            - prefix: public/upload

有任何想法吗?我在网上阅读了一些有关此错误的帖子,并尝试了以下操作:

但是,到目前为止还没有成功。

我目前正在使用最新版本的无服务器(2.50)

问候

标签: amazon-web-servicesamazon-s3amazon-cloudformationserverless-frameworkserverless

解决方案


推荐阅读