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.

pika.exceptions.AMQPConnectionError

See original GitHub issue

when I want to connect to rabbitmq by Pika in django project, I get this error:

File "/code/auth-service/utils/consumers.py", line 15, in <module>
     connection = pika.BlockingConnection(parameters)
   File "/usr/local/lib/python3.8/site-packages/pika/adapters/blocking_connection.py", line 360, in __init__
    self._impl = self._create_connection(parameters, _impl_class)
  File "/usr/local/lib/python3.8/site-packages/pika/adapters/blocking_connection.py", line 451, in _create_connection
     raise self._reap_last_connection_workflow_error(error)
 pika.exceptions.AMQPConnectionError

my code is:

connection = pika.BlockingConnection(pika.ConnectionParameters(host='rabbitmq'))

all my projects run by docker-compose.yml file I appreciate for any help to solving this problem

Issue Analytics

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

github_iconTop GitHub Comments

8reactions
pra-dancommented, Feb 18, 2022

On MAC, providing localhost leads to this error; instead explicitly providing 127.0.0.1 works as

connection = pika.BlockingConnection(pika.ConnectionParameters('127.0.0.1'))
1reaction
jesmaelnezhadcommented, Jun 7, 2022

I had this problem, and in my case, the problem was that there is a time gap between RabbitMQ start and when it’s ready to accept connections. So my problem was simply solved by waiting 30 seconds before trying to connect (I was connecting from a container that would start right after RabbitMQ’s container).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Program Running Pika Throwing AMQPConnectionError
_reap_last_connection_workflow_error(error) pika.exceptions.AMQPConnectionError. Here's the code I'm attempting to run:
Read more >
How to use the pika.exceptions.AMQPConnectionError ... - Snyk
To help you get started, we've selected a few pika.exceptions.AMQPConnectionError examples, based on popular ways it is used in public projects.
Read more >
Exceptions — pika 1.2.1 documentation - Read the Docs
Close from broker; may be passed as reason to channel's on-closed callback of non-blocking connection adapters or raised by BlockingConnection . NEW in...
Read more >
pika.exceptions.AMQPConnectionError - Error while running ...
I have a python docker container that is dependent on rabbitmq. I tried to link these two containers using docker-compose file:
Read more >
python - Why am I receiving this "pika.exceptions ... - Ask Ubuntu
Whenever I try to run this file I receive a "pika.exceptions.AMQPConnectionError". I do not have RabbitMQ installed and cannot use it for ...
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