Kombu Incorrect parsing of SQS hostname when credentials include a /
See original GitHub issueLooking at the docs on how to use the AWS SQS queue, it is recommended to use a BROKER_URL of format: sqs://AWS_ACCESS_KEY_ID:AWS_SECRET_ACCESS_KEY@
, as seen in your docs:
http://docs.celeryproject.org/en/latest/getting-started/brokers/sqs.html
Using the example in your docs:
broker_url = 'sqs://ABCDEFGHIJKLMNOPQRST:ZYXK7NiynGlTogH8Nj+P9nlE73sq3@'
but instead using “Alice’s” credentials from: https://aws.amazon.com/blogs/security/how-to-rotate-access-keys-for-iam-users/
$ aws iam create-access-key --user-name Alice
{
"AccessKey": {
"UserName": "Alice",
"Status": "Active",
"CreateDate": "2013-09-06T17:09:10.384Z",
"SecretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY",
"AccessKeyId": “AKIAIOSFODNN7EXAMPLE"
}
}
Your broker_url
is now:
broker_url = 'sqs://AKIAIOSFODNN7EXAMPLE:wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY@'
Full code for the example is now:
from celery import Celery
broker_url = 'sqs://AKIAIOSFODNN7EXAMPLE:wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY@'
app = Celery('tasks', broker=broker_url)
@app.task
def add(x, y):
return x + y
Run it with: celery -A tasks worker --loglevel=info
What you then end up with, is a parsing issue, such as:
File "/usr/local/lib/python3.6/site-packages/kombu/connection.py", line 181, in __init__
url_params = parse_url(hostname)
File "/usr/local/lib/python3.6/site-packages/kombu/utils/url.py", line 34, in parse_url
scheme, host, port, user, password, path, query = _parse_url(url)
File "/usr/local/lib/python3.6/site-packages/kombu/utils/url.py", line 52, in url_to_parts
parts.port,
File "/usr/local/lib/python3.6/urllib/parse.py", line 159, in port
port = int(port, 10)
ValueError: invalid literal for int() with base 10: 'wJalrXUtnFEMI'`
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Kombu Documentation - Read the Docs
Kombu is a messaging library for Python. The aim of Kombu is to make messaging in Python as easy as possible by providing...
Read more >Change history — Kombu 5.2.4 documentation - Celery
When using the SQS broker, FIFO queues with names that ended with the 'f' letter were incorrectly parsed. This is now fixed. Contributed...
Read more >Troubleshoot QueueDoesNotExist errors when making API ...
A QueueDoesNotExist exception returns when the request is made to the incorrect AWS Region. The software development kit (SDK) and AWS Command ...
Read more >celery Changelog - pyup.io
Warn about missing hostname only when default one is available (1488). ... Fix: non kombu json message decoding in SQS transport (1306). -...
Read more >Spring Cloud AWS SQS fails to connect to service endpoint ...
I have received below errors when running Spring Boot Project for AWS SNS i.InstanceMetadataServiceResourceFetcher : Fail to retrieve token ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@georgepsarakis It’d be good to update the documentation to indicate so - Having:
sqs://aws_access_key_id:aws_secret_access_key@
as the URL format in the doc is quite misleading.For the record, this works:
I’ll create a PR for the docs ~tomorrow~ at some point ; )