【问题标题】:lambda deployed through serverless with plugin serverless-plugin-existing-s3 doesn't trigger on S3 upload event通过带有插件 serverless-plugin-existing-s3 的无服务器部署的 lambda 不会在 S3 上传事件上触发
【发布时间】:2019-06-26 06:30:51
【问题描述】:

我正在部署无服务器 lambda 环境并使用 serverless-plugin-existing-s3 插件,一切都很好,但 S3 事件在我上传文件时不会触发 lambda。

代码示例:

service: test-storage
package:
  individually: true

plugins:
  - serverless-plugin-existing-s3
  - serverless-plugin-include-dependencies

provider:
  name: aws
  runtime: nodejs8.10
  iamRoleStatements:
    - Effect: "Allow"
        Action:
          - "s3:PutBucketNotification"
        Resource:
          Fn::Join:
            - ""
            - - "arn:aws:s3:::TESTBUCKET"

functions:
  onPimImportTrigger:
    handler: testFunc/testFunc.handler
    name: testFunc
    description: Detect file(s) uploaded to Bucket-S3, and handle lambda
    events:
      - existingS3:
          bucket: S3_BUCKET_NAME
          events:
            - s3:ObjectCreated:*
          rules:
            - prefix: TEST/IN
            - suffix: .txt

我不明白,我关注了package documentation。 感谢您的帮助。

【问题讨论】:

  • 你不是忘记重命名存储桶名称了吗? bucket: S3_BUCKET_NAME -> bucket: TESTBUCKET

标签: node.js amazon-s3 aws-lambda amazon-cloudformation serverless


【解决方案1】:

部署代码后运行命令

serverless s3deploy --stage yourstage

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-10
    • 2018-04-01
    • 2022-01-18
    • 1970-01-01
    • 1970-01-01
    • 2019-08-12
    • 2021-08-27
    • 1970-01-01
    相关资源
    最近更新 更多