调用SQS CreateQueue接口返回NonExistentQueue错误的技术问询
I totally get the confusion here—calling CreateQueue and getting a NonExistentQueue error that’s not listed in the official API docs feels counterintuitive. Let’s break down the most common scenarios that trigger this and how to fix them:
You’re referencing a non-existent resource in queue attributes
This is the most frequent cause. If yourCreateQueuerequest includes attributes that depend on another resource that doesn’t exist, SQS will throw this error. For example:- A
RedrivePolicypointing to a dead-letter queue (DLQ) that hasn’t been created yet, or with a typo in its ARN/name - A
KmsMasterKeyIdreferencing a KMS key that doesn’t exist in your account/region - Any other attribute that relies on an external SQS queue or resource that’s missing
Fix: Double-check all attribute values in your request. Verify that DLQs, KMS keys, or other referenced resources exist, and that their ARNs/IDs are spelled exactly correctly.
- A
Accidental references to a non-existent queue in your request
Sometimes SDKs or custom code can sneak in unintended references to another queue. For example, if you’re reusing a parameter object from a previousGetQueueAttributescall, you might accidentally include aQueueArnattribute that points to a queue no longer exists.
Fix: Inspect the full payload of yourCreateQueuerequest. If you’re using the AWS CLI, add the--debugflag to see the exact JSON being sent. Remove any extraneous attributes that reference queues you don’t intend to use here.Region mismatch issues
If your SDK/CLI is configured for a different region than where you’re trying to create the queue, or if you’re referencing a resource (like a DLQ) in another region without using its full cross-region ARN, SQS won’t find the resource and throw this error.
Fix: Confirm your AWS client’s region matches the target region for the new queue. When referencing cross-region resources, use their complete ARN (including the region segment) to ensure SQS can locate them.Rare AWS service-side glitches
While uncommon, temporary service inconsistencies can sometimes lead to misleading error messages. If you’ve ruled out all the above, try retrying the request a few times, or check if there are any ongoing SQS issues in your region via the AWS Health Dashboard.
It’s worth noting that even though this error isn’t explicitly listed in the CreateQueue docs, it’s a generic SQS error for missing dependent resources. You can use ListQueues or GetQueueAttributes to validate the existence of any referenced resources before calling CreateQueue.
内容的提问来源于stack exchange,提问作者hrdwdmrbl

