Closed bsda closed 7 years ago
The launcher expects region to be set in a credentials file or in an environment variable, as is stated in the readme.
The readme mentions that AWS_ACCOUNT_ID must be set in the environment variable, there is no mention of region.
Anyway, why is the behaviour for the listener different from the launcher. If I'm specifying the queue for the listener and an exception happens, I think that in most cases I would want to use the same region for the error queue.
If I recall correctly, this was the behavior for both components, and in a pull request passing the region as a parameter was added to the listener only. It seems there is a great deal more usage of the listener than the launcher by the community.
You're more than welcome to submit a pull request with specific changes
Every time the handle_message fails to process a message for some reason, it gets an exception when it tries send a message to the error queue. I could also be making a mistake.
I'm fairly new to python, from what I can see the issue is that the region is not being passed to sqs_launcher. I've fixed it in my fork, but it might not be the correct way. I'll submit a pull request anyway.
Traceback (most recent call last): File "/testing.py", line 67, in
listener.listen()
File "/usr/local/lib/python3.5/dist-packages/sqs_listener/init.py", line 156, in listen
self._start_listening()
File "/usr/local/lib/python3.5/dist-packages/sqs_listener/init.py", line 140, in _start_listening
error_launcher = SqsLauncher(self._error_queue_name, True)
File "/usr/local/lib/python3.5/dist-packages/sqs_launcher/init.py", line 39, in init
self._client = boto3.client('sqs')
File "/usr/local/lib/python3.5/dist-packages/boto3/init.py", line 83, in client
return _get_default_session().client(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/boto3/session.py", line 263, in client
aws_session_token=aws_session_token, config=config)
File "/usr/local/lib/python3.5/dist-packages/botocore/session.py", line 836, in create_client
client_config=config, api_version=api_version)
File "/usr/local/lib/python3.5/dist-packages/botocore/client.py", line 71, in create_client
verify, credentials, scoped_config, client_config, endpoint_bridge)
File "/usr/local/lib/python3.5/dist-packages/botocore/client.py", line 281, in _get_client_args
verify, credentials, scoped_config, client_config, endpoint_bridge)
File "/usr/local/lib/python3.5/dist-packages/botocore/args.py", line 45, in get_client_args
endpoint_url, is_secure, scoped_config)
File "/usr/local/lib/python3.5/dist-packages/botocore/args.py", line 111, in compute_client_args
service_name, region_name, endpoint_url, is_secure)
File "/usr/local/lib/python3.5/dist-packages/botocore/client.py", line 354, in resolve
service_name, region_name)
File "/usr/local/lib/python3.5/dist-packages/botocore/regions.py", line 122, in construct_endpoint
partition, service_name, region_name)
File "/usr/local/lib/python3.5/dist-packages/botocore/regions.py", line 135, in _endpoint_for_partition
raise NoRegionError()
botocore.exceptions.NoRegionError: You must specify a region.