Lounis
Lounis

Reputation: 647

lambda deployed through serverless with plugin serverless-plugin-existing-s3 doesn't trigger on S3 upload event

I am deploying serverless lambda environment and using serverless-plugin-existing-s3, all is fine but the S3 event doesn't trigger lambda when I upload files.

Example of code :

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

I don't understand, i followed package documentation. Thanks for help.

Upvotes: 0

Views: 587

Answers (1)

Najiba Halim
Najiba Halim

Reputation: 130

Just run the command after deploying the code

serverless s3deploy --stage yourstage

Upvotes: 1

Related Questions