Skip to content

(aws-lambda-event-sources): S3EventSource should take IBucket instead of Bucket #4323

Closed
@guangyuzh

Description

Reproduction Steps

Cannot import an existing s3 bucket when creating Lambda s3 events:

  1. aws_s3.Bucket.from_bucket_name(...) or aws_s3.Bucket.from_bucket_arn(...), etc. returns aws_s3.IBucket type
  2. However, aws_lambda_event_sources.S3EventSource only takes aws_s3.Bucket type as a parameter
  3. Note: aws_s3.Bucket implements aws_s3.IBucket

Error Log

File "/usr/local/lib/python3.6/site-packages/jsii/_runtime.py", line 66, in __call__
    inst = super().__call__(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/aws_cdk/aws_lambda_event_sources/__init__.py", line 199, in __init__
    jsii.create(S3EventSource, self, [bucket, props])
  File "/usr/local/lib/python3.6/site-packages/jsii/_kernel/__init__.py", line 208, in create
    overrides=overrides,
  File "/usr/local/lib/python3.6/site-packages/jsii/_kernel/providers/process.py", line 331, in create
    return self._process.send(request, CreateResponse)
  File "/usr/local/lib/python3.6/site-packages/jsii/_kernel/providers/process.py", line 316, in send
    raise JSIIError(resp.error) from JavaScriptError(resp.stack)
jsii.errors.JSIIError: Object of type @aws-cdk/aws-s3.IBucket is not convertible to @aws-cdk/aws-s3.Bucket

Environment

  • CLI Version : v1.10.1
  • Framework Version: v1.10.1
  • OS : Mac OS
  • Language : Python

Other

aws_lambda_event_sources.S3EventSource should take aws_s3.IBucket as a parameter's type.


This is 🐛 Bug Report

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions