Spring-cloud-aws: SQS listener configured with @SqsListener not finding queue - "Ignoring queue with name as it does not exist."

Created on 6 Feb 2019  路  3Comments  路  Source: spring-cloud/spring-cloud-aws

I have a SpringBoot SQSListener configured as follows

    @SqsListener(value = "${clients.xyz.queueName}", deletionPolicy = SqsMessageDeletionPolicy.ON_SUCCESS)
    public void onMessage(String message) {
}

This was working fine on my local but I saw an exception during application startup in AWS

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stackResourceRegistryFactoryBean' defined in class path resource [org/springframework/cloud/aws/autoconfigure/context/ContextStackAutoConfiguration$StackAutoDetectConfiguration.class]: Invocation of init method failed; nested exception is com.amazonaws.services.cloudformation.model.AmazonCloudFormationException: User: arn:aws:sts::xyz:assumed-role/xyz-instance/i-xyz is not authorized to perform: cloudformation:ListStackResources on resource: arn:aws:cloudformation:us-west-2:xyz:stack/xyz-preprod-qa-xyz-asg/* (Service: AmazonCloudFormation; Status Code: 403;

I figured the consumer is trying to find the queue defined via @SqsListener so I gave the permission.I no longer see an error after giving the permission but the messages are not being read either.

Looking at the above exception my ec2 instance did a ListStackResources on arn:aws:cloudformation:us-west-2:xyz:stack/xyz-preprod-qa-xyz-asg. I am trying to figure out why it needs to do ListStackResources on ASG? How is the queue detected?

Seeing this warning log - "Ignoring queue with name 'app-xyz-qa-xyz-queue.fifo' as it does not exist."

sqs

Most helpful comment

@rpudota having this in your property file can help you. cloud.aws.stack.auto = false

All 3 comments

In my case it was a permission problem. Giving permission to the EKS workers to access the SQS queue, made the listener to work fine.

@rpudota having this in your property file can help you. cloud.aws.stack.auto = false

Thanks @darkknightawakens. Indeed the issue comes from having CloudFormation support turned on. From 2.3 it will be off by default.

Was this page helpful?
0 / 5 - 0 ratings