微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 s3 事件上使用“existing: true”会抛出“无法验证以下目标配置”

如何解决在 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

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

  • 首先部署 lambda,然后附加通知事件。
  • 将 lambda:InvokeFunction 作为对存储桶的 IAM 权限。
  • 尝试使用 serverless-plugin-existing-s3

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

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

问候

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。