我正在部署无服务器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。 感谢您的帮助。
答案 0 :(得分:0)
只需在部署代码后运行命令
serverless s3deploy --stage yourstage