-
-
Notifications
You must be signed in to change notification settings - Fork 312
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
Error resolving attributes for queue with strategy CREATE and queueAttributesNames #1022
Comments
At first, if you do not need to create sqs\sns automatically you can create the template like this with QueueNotFoundStrategy.FAIL:
I had the same error with the same version of aws libraries, and after debugging I realized that it was an auth error, but QueueAttributesResolvingException intercepts it. Try to test it with a localstack and provide just one credential provider, for example like this:
Credential env variables should be provided for application before lunch: SQS should be created before as well: In case the same error appears try to debug EnvironmentVariableCredentialsProvider and make sure that envs in place and the localstak url is correct. |
@Divyrajput123 , can you share the full stacktrace of the issue? Thanks. |
@Divyrajput123 , I'll close this issue due to lack of feedback. This is probably related to an issue when auto creating FIFO queues that has already been fixed but since I don't have a stack trace or more info I can't guarantee. We can reopen if necessary. |
Yeah, there is still a problem with fifo queue and CREATE strategy... |
In version 3.1.1 I have problem with standard and fifo queue. :/ In version 3.1.0 it works but only for standard queue.
My code looks like:
|
Hmm, that's weird. The only resource I could find for Http Status 307 on AWS was this one for S3, which points to a resource being created in a region and accessed from another region before it propagates in 24h: https://repost.aws/knowledge-center/s3-http-307-response Rings any bells? If you can create a sample project that reproduces the issue I'd be happy to take a look. |
It is definitely wird in this case. ;) But like I said, I've only changed the vesrion of spring-cloud-aws and experimenting with .fifo suffix. Sometimes it works, sometimes not. I will check it on clean AWS resources, because I am using Scaleway, so maybe here is problem...? I will let you know, thanks! |
Hitting this same issue, too - looks specific to |
Hey @ahileseverquote, did you try it in 3.1.1? |
Hey @webranch-pl, can you send me the link to the open issues about this you mentioned? It would also be helpful if you would be able to create a sample project that reproduces the issue with minimal code as I asked. Keep in mind this is a community project, none of us are paid to be here looking into these issues :) |
@tomazfernandes, I confirmed that problem was due to using Scaleway more than AWS and I think it is already resolved in version 3.1.1. Thank you for your assist! I am going to continue testing yuor project! Great work! ;) |
Awesome news @webranch-pl, thanks for looking into this and reporting back. If anyone else still has any issues after upgrading to 3.1.1 please let me know. |
I had a similar issue with 3.1.1 because of an old version of the docker image localstack/localstack (we use localstack in our integration tests). It worked with 3.1.0 but didn't with 3.1.1. Just an FYI, maybe this helps someone. |
I am facing same issue.
and In .aws/credentials, I have
Here is the error Here is my SqsClientConfig
|
@abhimanyuPatil this is a different issue. In your case, SDK is not able to resolve credentials. Since you're using |
Hello! Could you help me resolve this issue I use image: localstack/localstack:3.4.0 I've created 2 pairs of queue "http://sqs.eu-west-2.localhost.localstack.cloud:4566/000000000000/stag-offline-payments-service-sms-forwardings.fifo", when I try ti start docker-compose file with my app I'm getting Caused by: java.util.concurrent.CompletionException: io.awspring.cloud.sqs.QueueAttributesResolvingException: Error resolving attributes for queue stage-offlien-payments-service-sms-responses with strategy CREATE and queueAttributesNames [] |
@rddch , same issue I am facing, is it resolved for you ?? |
I am also facing the same issue |
@shirishreseaugroup @nilesh-chordia @rddch can you provide a sample that reproduces this issue? |
I have the same issue after upgrading to Spring Boot 3.2.2 This is the stack trace
and This is the configuration @TestConfiguration
public class SQSTestConfig implements ApplicationContextInitializer<ConfigurableApplicationContext> {
@Value("${spring.cloud.aws.sqs.endpoint}")
private String sqsUrl;
@Value("${spring.cloud.aws.region.static}")
private String region;
@Value("${aws.sqs.demo-queue}")
private String sourceQueueName;
@Value("${aws.sqs.demo-dlq}")
private String deadLetterQueueName;
private SQSRestServer server;
@PostConstruct
public void init() {
initSQS();
}
@PreDestroy
public void preDestroy() {
server.stopAndWait();
}
@Bean
SqsAsyncClient sqsAsyncClient() {
return SqsAsyncClient.builder().region(Region.of(region)).endpointOverride(URI.create(sqsUrl))
.credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create("x", "x"))).build();
}
// Initialize SQS
private void initSQS() {
try {
SqsAsyncClient sqs = SqsAsyncClient.builder().region(Region.of(region)).endpointOverride(URI.create(sqsUrl))
.credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create("x", "x")))
.build();
if (server == null) {
// Start Server
server = SQSRestServerBuilder.withPort(new URL(sqsUrl).getPort()).start();
createSQSQueueWithDLQ(sqs, sourceQueueName, deadLetterQueueName);
}
} catch (InterruptedException | ExecutionException e) {
Throwable cause = e.getCause();
if (cause instanceof SqsException) {
SqsException sqsEx = (SqsException) cause;
System.err.println("Error message: " + sqsEx.awsErrorDetails().errorMessage());
System.err.println("Error code: " + sqsEx.awsErrorDetails().errorCode());
} else {
e.printStackTrace();
}
} catch (Exception e) {
throw new RuntimeException("Failed SQS initialization", e);
}
}
private void createSQSQueueWithDLQ(SqsAsyncClient sqs, String queueName, String dlqName)
throws InterruptedException, ExecutionException {
// Create Main normal queue
String queueUrl = sqs.createQueue(CreateQueueRequest.builder().queueName(queueName).build()).get().queueUrl();
System.out.println("Queue created with URL: " + queueUrl);
// Create Dead Letter Queue (DLQ) for normal queue
String dlqQueueUrl = sqs.createQueue(CreateQueueRequest.builder().queueName(dlqName).build()).get().queueUrl();
System.out.println("DLQ created with URL: " + dlqQueueUrl);
// Get DLQ ARN
String dlqArn = sqs
.getQueueAttributes(GetQueueAttributesRequest.builder().queueUrl(dlqQueueUrl)
.attributeNames(QueueAttributeName.QUEUE_ARN).build())
.get().attributes().get(QueueAttributeName.QUEUE_ARN);
}
// Set sqs info properties for @Value injection, specially the port
private void setUrlProperty(ConfigurableApplicationContext context) {
try {
// Generate random free port
ServerSocket serverSocket = new ServerSocket(0);
int port = serverSocket.getLocalPort();
serverSocket.close();
// Assign config properties with dynamic port and already configured
// application.yaml properties
ConfigurableEnvironment environment = context.getEnvironment();
String oldEndpoint = environment.getProperty("spring.cloud.aws.sqs.endpoint");
String newUrl = Objects.requireNonNull(oldEndpoint).replace("5235", String.valueOf(port));
sqsUrl = newUrl;
// Put the new url as property in the context/environment
Properties props = new Properties();
props.put("spring.cloud.aws.sqs.endpoint", newUrl);
environment.getPropertySources().addFirst(new PropertiesPropertySource("whatever", props));
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException("Failed to get random port", e);
}
}
@Override
public void initialize(@NonNull ConfigurableApplicationContext applicationContext) {
setUrlProperty(applicationContext);
} |
I am trying to run my spring boot 3.0.8 application in local, while running the app is failing with following reason
Caused by: java.util.concurrent.CompletionException: io.awspring.cloud.sqs.QueueAttributesResolvingException: Error resolving attributes for queue myqueue with strategy CREATE and queueAttributesNames []
}
I am using the below dependencies,
implementation platform("io.awspring.cloud:spring-cloud-aws-dependencies:3.0.1")
implementation 'io.awspring.cloud:spring-cloud-aws-starter-sqs'
implementation 'io.awspring.cloud:spring-cloud-aws-starter-sns'
The text was updated successfully, but these errors were encountered: