Skip to content

[@aws-cdk/aws-lambda-event-sources] Add Lambda as event source in SQS producing Error #9782

@niciqy

Description

@niciqy

I am trying out with the example found in CDK site. Essentially, it trying to add a lambda as event source to SQS

import * as sqs from '@aws-cdk/aws-sqs';
import { SqsEventSource } from '@aws-cdk/aws-lambda-event-sources';
import { Duration } from '@aws-cdk/core';

const queue = new sqs.Queue(this, 'MyQueue', {
  visibilityTimeout: Duration.seconds(30)      // default,
  receiveMessageWaitTime: Duration.seconds(20) // default
});

lambda.addEventSource(new SqsEventSource(queue, {
  batchSize: 10 // default
});

I am getting this error:
Argument of type 'SqsEventSource' is not assignable to parameter of type 'IEventSource'. Types of property 'bind' are incompatible.

Environment

  • CLI Version 1.57.0:
  • Framework Version:
  • Node.js Version: v10.16.3
  • OS : OSX 10.14.3
  • Language (Version): TypeScript (3.8.3)

This is 🐛 Bug Report

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-lambda-event-sourcesbugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.response-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions