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

aws_dynamodb_stream_lambda raises exception when using existing Table #119

Closed
jabrennem opened this issue Jan 12, 2021 · 2 comments · Fixed by #214
Closed

aws_dynamodb_stream_lambda raises exception when using existing Table #119

jabrennem opened this issue Jan 12, 2021 · 2 comments · Fixed by #214
Assignees
Labels
bug Something isn't working in-progress This issue is being actively worked on

Comments

@jabrennem
Copy link

jabrennem commented Jan 12, 2021

This might be a user error, but I am using an existing DynamoDB table with the DynamoDBStreamToLambda class. When I do cdk diff or cdk synth, I receive this error.

jsii.errors.JSIIError: Object of type @aws-cdk/core.Resource is not convertible to @aws-cdk/aws-dynamodb.Table

The object that is being passed to the existing_table_obj is <jsii._reference_map.InterfaceDynamicProxy object at 0x10afdbb50>. from_table_name states that it returns an object of type ITable. Perhaps this is the issue? Is there a way to convert ITable to a Table object?

Reproduction Steps

table = db.Table.from_table_name(self, 'StreamTable', 'myexistingtable')

DynamoDBStreamToLambda(
    self, 
    'TableStreamToLambda',
    existing_table_obj=table,
    lambda_function_props=lb.FunctionProps(
        function_name=function_name,
        code=lb.Code.from_asset('./lambda_functions'),
        runtime=lb.Runtime.PYTHON_3_8,
        handler='index.handler'
))

Error Log

jsii.errors.JSIIError: Object of type @aws-cdk/core.Resource is not convertible to @aws-cdk/aws-dynamodb.Table

Environment

  • CDK CLI Version: 1.83.0 (build 827c5f4)
  • CDK Framework Version: 1.80.0
  • AWS Solutions Constructs Version : 1.80.0
  • OS : Mac
  • Language : python

Other


This is 🐛 Bug Report

@jabrennem jabrennem added bug Something isn't working needs-triage The issue or PR still needs to be triaged labels Jan 12, 2021
@hnishar hnishar added in-progress This issue is being actively worked on and removed needs-triage The issue or PR still needs to be triaged labels Jan 12, 2021
@hnishar hnishar self-assigned this Jan 12, 2021
@hnishar
Copy link
Contributor

hnishar commented Jan 12, 2021

jabrennem@ While existing_table_obj can be converted to accept ITable instead of Table, the limitation of ITable is it does not support any mutating operation on the existing table. I'll look into this if this pattern does not require such operation, than it can be converted to accept ITable instead of Table

@biffgaut
Copy link
Contributor

We have added this change (changing props from Table to ITable) to the backlog. It has been approved and assigned, but there is no ETA at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in-progress This issue is being actively worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants