Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for S3:Events Prefix and Suffix Rules #93

Open
fffan64 opened this issue Apr 23, 2020 · 6 comments
Open

Support for S3:Events Prefix and Suffix Rules #93

fffan64 opened this issue Apr 23, 2020 · 6 comments

Comments

@fffan64
Copy link

fffan64 commented Apr 23, 2020

Please see
#27 (comment)

same problem in latest version 0.5.4
trigger all the time, ignore the rules filter

thanks !

@aklein-dex
Copy link

Same issue for me.
serverless-s3-local version: 0.4.4

$ sls --version
Framework Core: 1.66.0
Plugin: 3.5.0
SDK: 2.3.0
Components: 2.22.3

https://serverless.com/framework/docs/providers/aws/events/s3#setting-filter-rules
Despite the suffix is .jpg, if I add a file test.txt, it triggers the lambda.

@ar90n
Copy link
Owner

ar90n commented Apr 27, 2020

Thanks for your reports.
But I couldn't reproduce this issue.
I guess this issue was caused by not catching up on the latest version of serverless and serverless-offline.
So I published a new version of serverless-s3-local to catch up on them.
Could you try it?

@fffan64
Copy link
Author

fffan64 commented Apr 28, 2020

thank you but same, i updated everything:

"serverless": "^1.68.0",
"serverless-offline": "^6.1.4",
"serverless-s3-local": "^0.6.0",

i can see this log if it can help

starting handler
Serverless: Found S3 event listener for mybucket
[
  {
    name: 'mybucket',
    pattern: '.*',
    rules: [],
    func: [Function: func]
  }
]
warn: the bucket "mybucket" already exists
S3 local started ( port:8000, family: IPv4, address: 127.0.0.1 )
Serverless: creating bucket: mybucket
error: Error creating bucket. Bucket "mybucket" already exists
info: PUT /mybucket 409 6ms -

@ar90n
Copy link
Owner

ar90n commented Apr 28, 2020

Umm...
It seems that there are no problems.
This error is caused by a bucket whose name is same already existing.
But this bucket works correctly.

If you don't mind, could you share your serverless.yml or essential part of it.
I want to reproduce this issue in my environment.
Or please try to run the resize_image example. I guess this example is similar to your product.

@fffan64
Copy link
Author

fffan64 commented May 1, 2020

ok, i found the mistake :/

i was declaring like that (WRONG)

events:
      - s3: ${self:custom.s3_bucket}
        event: s3:ObjectCreated:*
        rules:
          - prefix: ${self:custom.s3_key_base_input}
          - suffix: .zip

intead of (GOOD)

events:
      - s3: 
          bucket: ${self:custom.s3_bucket}
          event: s3:ObjectCreated:*
          rules:
            - prefix: ${self:custom.s3_key_base_input}
            - suffix: .zip

sorry for the trouble, though i was sure it worked on real s3...

@ar90n
Copy link
Owner

ar90n commented May 2, 2020

@fffan64
Thanks for your great report. It is good for me.
And I apologize to you for annoying.
I fixed this bug and published a new version v0.6.1.
If you don't mind, please try it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants