ademartini
ademartini

Reputation: 1441

AWS Lambda Publishing to SNS

I'm experiencing a strange issue with Amazon SNS. When I publish a message using the AWS UI (publish to topic button), messages are delivered immediately.

But when I publish a message to the same topic from inside a lambda function, messages will either not be delivered, or will be delivered after some more messages are published by future invocations of the lambda.

What could be different?

Update

I tried publishing with the AWS CLI cool, and that works fine also.

I'm using the Java SNS library for my lambda. I'm using the default credentials of the lambda. I construct the PublishRequest with just the topic ARN, message, and subject. The publish call returns successfully, and I see it my logs in the cloudwatch logs.

What would cause an SNS message to delay in being delivered until more SNS messages are sent? I'm testing out with both Email and SQS subscriptions - both behave the same.

Upvotes: 1

Views: 2619

Answers (1)

ademartini
ademartini

Reputation: 1441

I figured out the problem. Although I thought I was waiting for the SNS publish request to send, I actually wasn't. So bottom line, make sure your async stuff finishes in these lambdas or you could see strange behavior. Thanks to John Rotenstein above for pointing me in the right direction.

Upvotes: 4

Related Questions