S3 event: folder created to trigger a lambda

Doc looks very clear Serverless Framework - AWS Lambda Events - S3

However, it’s not working for me and I suspect it has to do with the way I’m doing.

Basically, whenever a folder starting with final-.... (which contains two files) is uploaded to a folder in a bucket, I want to trigger the lambda (which I know is working).

Here’s my basic config:

functions:
  heyex-pipe:
    timeout: ${self:custom.timeout}
    image:
      name: heyex-pipe-docker
    environment:
      BUCKET: ${self:custom.s3bucket.${sls:stage}.name}
    events:
      - s3:
          bucket: ${self:custom.s3bucket.${sls:stage}.name}
          event: "s3:ObjectCreated:*"
          existing: true
          forcedeploy: true
          rules:
            - prefix: AISolutionFolder/final-

So, if I do:

aws s3 sync tests/final-example-id-folder-dcms s3://my-test/AISolutionFolder/final-example-id-folder-dcms

this is not triggering the lambda.

Any idea what I could do further?

I went with a solution where I trigger the lambda with a file, the usual way and then, based on the file content, I let only one to carry on the lambda routine, all others don’t.

Hi there,
the example in the doc looks like this, where the “upload” folder has “/” at the end

functions:
users:
handler: users.handler
events:
- s3:
bucket: photos
event: s3:ObjectCreated:*
rules:
- prefix: uploads/
- suffix: .jpg