aws-cdk-examples: Argument of type 'Function' is not assignable to parameter of type 'IFunction'.
OS: macOS 10.14.6 aws-cdk/core: 1.0.0 aws-cdk/aws-lambda: 1.0.0 aws-cdk/aws-events: 1.1.0 aws-cdk/aws-events-targets: 1.1.0 cdk: 1.0.0 (build d89592e)
I am trying to create a stack similar to the lambda-cron example.
While adding lambda function to rule, it is erring out.
Add a lambda function as a target:
rule.addTarget(new targets.LambdaFunction(queueConsumer));
queueConsumer
is a lambda function (aws-cdk/aws-lambda.Function
) that consumes messages from a SQS queue.
Error while adding the target
Argument of type 'Function' is not assignable to parameter of type 'IFunction'.
Is there any way to get the IFunction object from the lambda.Function object?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 39 (19 by maintainers)
A somewhat dirty workaround that worked for me:
Basically using
require
instead ofimport
solved the problem“npm update” solved the issue for me.
You may try updating your dependencies. Make sure that all modules under aws-cdk have same versions installed.
This configuration worked for me.
{ "dependencies": { "@aws-cdk/aws-events-targets": "^1.18.0", "@aws-cdk/aws-glue": "^1.18.0", "@aws-cdk/aws-kinesisfirehose": "^1.18.0", "@aws-cdk/aws-s3": "^1.18.0", "@aws-cdk/aws-sns": "^1.18.0", "@aws-cdk/aws-sns-subscriptions": "^1.18.0", "@aws-cdk/core": "^1.18.0" } }
Always when installing something in version different than core version.