Swift
Swift

Reputation: 113

Celery Flower UNAUTHENTICATED_API not working

I am working on a project using celery workers and Flower to monitor those workers. Both the worker and Flower are running as images inside one container. I want to change attributes of the worker using Flower, but trying to change values via the Flower web UI invokes the following error: FLOWER_UNAUTHENTICATED_API environment variable is required to enable API without authentication

I am starting the worker with celery -A app.celery.celery_worker.celery worker --loglevel=info and Flower with celery -A app.celery.celery_worker.celery flower --port=${PORT} --conf=app/celery/flowerconfig.py

I tried to set up a flowerconfig file with FLOWER_UNAUTHENTICATED_API = True at the path specified in the celery flower command. Still, when using the web UI of Flower to change values, the same error message pops up and Flower outputs 401 POST /api/worker/pool/grow/celery@615b8e2b9e60 (172.18.0.1): FLOWER_UNAUTHENTICATED_API environment variable is required to enable API without authentication

Upvotes: 3

Views: 3608

Answers (2)

Guinther Kovalski
Guinther Kovalski

Reputation: 1909

Had the same problem and it was just a small detail in my case. Try to make sure you have add the env variable the right way, it can be with the command:

export FLOWER_UNAUTHENTICATED_API="true"

or in a .env file as:

FLOWER_UNAUTHENTICATED_API=true

attention to the lowercase and no space around the equal sign

Upvotes: 0

C. Zeil
C. Zeil

Reputation: 33

I ran into the same issue and I worked around it by specifying the '--basic-auth' option, where you can specify a user and a password when starting Celery Flower (Flower 2.0.0 Authentication Documentation). So the full command to start Flower would be as follows

celery 
    -A app.celery.celery_worker.celery
    flower 
    --port=${PORT}
    --basic-auth=user:pwd
    --conf=app/celery/flowerconfig.py

When you open the Flower interface in the browser you then get asked for these credentials and the interactions should work again. If you need a more sophisticated authentication, other options are also listed in the documentation.

Upvotes: 2

Related Questions