question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SQS worker errors our when Rejected

See original GitHub issue

I get the following error when I raise a Reject exception

‘str’ object has no attribute ‘headers’

full stacktrace:

[2021-07-22 16:01:04,309: CRITICAL/MainProcess] Unrecoverable error: AttributeError("'str' object has no attribute 'headers'")
Traceback (most recent call last):
  File "/home/shreyas/.local/share/virtualenvs/inai-backend-mwrd66wz/lib/python3.8/site-packages/celery/worker/worker.py", line 203, in start
    self.blueprint.start(self)
  File "/home/shreyas/.local/share/virtualenvs/inai-backend-mwrd66wz/lib/python3.8/site-packages/celery/bootsteps.py", line 116, in start
    step.start(parent)
  File "/home/shreyas/.local/share/virtualenvs/inai-backend-mwrd66wz/lib/python3.8/site-packages/celery/bootsteps.py", line 365, in start
    return self.obj.start()
  File "/home/shreyas/.local/share/virtualenvs/inai-backend-mwrd66wz/lib/python3.8/site-packages/celery/worker/consumer/consumer.py", line 326, in start
    blueprint.start(self)
  File "/home/shreyas/.local/share/virtualenvs/inai-backend-mwrd66wz/lib/python3.8/site-packages/celery/bootsteps.py", line 116, in start
    step.start(parent)
  File "/home/shreyas/.local/share/virtualenvs/inai-backend-mwrd66wz/lib/python3.8/site-packages/celery/worker/consumer/consumer.py", line 618, in start
    c.loop(*c.loop_args())
  File "/home/shreyas/.local/share/virtualenvs/inai-backend-mwrd66wz/lib/python3.8/site-packages/celery/worker/loops.py", line 81, in asynloop
    next(loop)
  File "/home/shreyas/.local/share/virtualenvs/inai-backend-mwrd66wz/lib/python3.8/site-packages/kombu/asynchronous/hub.py", line 298, in create_loop
    item()
  File "/home/shreyas/.local/share/virtualenvs/inai-backend-mwrd66wz/lib/python3.8/site-packages/vine/promises.py", line 160, in __call__
    return self.throw()
  File "/home/shreyas/.local/share/virtualenvs/inai-backend-mwrd66wz/lib/python3.8/site-packages/vine/promises.py", line 157, in __call__
    retval = fun(*final_args, **final_kwargs)
  File "/home/shreyas/.local/share/virtualenvs/inai-backend-mwrd66wz/lib/python3.8/site-packages/kombu/message.py", line 135, in reject_log_error
    self.reject(requeue=requeue)
  File "/home/shreyas/.local/share/virtualenvs/inai-backend-mwrd66wz/lib/python3.8/site-packages/kombu/message.py", line 156, in reject
    self.channel.basic_reject(self.delivery_tag, requeue=requeue)
  File "/home/shreyas/.local/share/virtualenvs/inai-backend-mwrd66wz/lib/python3.8/site-packages/kombu/transport/virtual/base.py", line 671, in basic_reject
    self.qos.reject(delivery_tag, requeue=requeue)
  File "/home/shreyas/.local/share/virtualenvs/inai-backend-mwrd66wz/lib/python3.8/site-packages/kombu/transport/SQS.py", line 179, in reject
    self.apply_backoff_policy(
  File "/home/shreyas/.local/share/virtualenvs/inai-backend-mwrd66wz/lib/python3.8/site-packages/kombu/transport/SQS.py", line 199, in apply_backoff_policy
    self.extract_task_name_and_number_of_retries(delivery_tag)
  File "/home/shreyas/.local/share/virtualenvs/inai-backend-mwrd66wz/lib/python3.8/site-packages/kombu/transport/SQS.py", line 213, in extract_task_name_and_number_of_retries
    message_headers = message.headers
AttributeError: 'str' object has no attribute 'headers'

When I fetched the actual message from SQS I found that some of the attributes were missing in the delivery tag. However in this case it fails even before it reaches that part.

Please help.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
thedrowcommented, Aug 22, 2021

This is now fixed! Thanks for the bug report.

0reactions
thedrowcommented, Aug 19, 2021

We’d gladly accept a contribution to fix this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot AccessDenied errors on Amazon SQS API calls
“An error occurred (AccessDenied ) when calling the SendMessage operation: Access to the resource https://sqs.us-east-1.amazonaws.com/ is denied.
Read more >
Reject doesn't un-ack SQS messages · Issue #697 - GitHub
The Reject documentation states: For inputs that support propagating nacks upstream such as AMQP or NATS the message will be nacked.
Read more >
5 Common Amazon SQS Issues - Dashbird
5 Common Amazon SQS Issues · 1. Java SDK – Cannot Receive Message Attributes · 2. SNS Topic Not Publishing to SQS ·...
Read more >
Amazon SQS Access Denied Exception - AWS re:Post
I am trying to send messages to an SQS queue. ... The tests run fine locally but in my dev environment, I am...
Read more >
Amazon ElasticBeanStalk Worker Tier cannot connect to SQS
Oddly enough, a plain vanilla Worker-Tier with a sample Queue also get these access denied errors. – Pepster. Jul 22, 2014 at 4:59....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found