PyQS icon indicating copy to clipboard operation
PyQS copied to clipboard

PyQS is not supporting localstack/ElasticMQ

Open amirraouf opened this issue 2 years ago • 0 comments

I need to run PyQS with local sqs implementation, everything is going right till I need to call a task delayer, it raises the problem of

/usr/local/lib/python3.8/site-packages/pyqs/decorator.py in wrapper(*args, **kwargs)
     32 
     33     def wrapper(*args, **kwargs):
---> 34         queue = get_or_create_queue(queue_name)
     35 
     36         _delay_seconds = delay_seconds

/usr/local/lib/python3.8/site-packages/pyqs/decorator.py in get_or_create_queue(queue_name)
     14     sqs = boto3.resource('sqs', region_name=region_name)
     15     try:
---> 16         return sqs.get_queue_by_name(QueueName=queue_name)
     17     except ClientError as exc:
     18         non_existent_code = 'AWS.SimpleQueueService.NonExistentQueue'

/usr/local/lib/python3.8/site-packages/boto3/resources/factory.py in do_action(self, *args, **kwargs)
    518             # instance via ``self``.
    519             def do_action(self, *args, **kwargs):
--> 520                 response = action(self, *args, **kwargs)
    521 
    522                 if hasattr(self, 'load'):

/usr/local/lib/python3.8/site-packages/boto3/resources/action.py in __call__(self, parent, *args, **kwargs)
     81                     operation_name, params)
     82 
---> 83         response = getattr(parent.meta.client, operation_name)(*args, **params)
     84 
     85         logger.debug('Response: %r', response)

/usr/local/lib/python3.8/site-packages/botocore/client.py in _api_call(self, *args, **kwargs)
    335                     "%s() only accepts keyword arguments." % py_operation_name)
    336             # The "self" in this scope is referring to the BaseClient.
--> 337             return self._make_api_call(operation_name, kwargs)
    338 
    339         _api_call.__name__ = str(py_operation_name)

/usr/local/lib/python3.8/site-packages/botocore/client.py in _make_api_call(self, operation_name, api_params)
    654             error_code = parsed_response.get("Error", {}).get("Code")
    655             error_class = self.exceptions.from_code(error_code)
--> 656             raise error_class(parsed_response, operation_name)
    657         else:
    658             return parsed_response

ClientError: An error occurred (InvalidClientTokenId) when calling the GetQueueUrl operation: The security token included in the request is invalid.

The sol.: At get_or_create_queue, the resource doesn't take endpoint url, which will solve the issue of preparing the sqs resource, while it been specified at the PyQS main call --endpoint-url

amirraouf avatar Apr 15 '22 09:04 amirraouf