Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to correctly inject config? #1330

Open
ntarocco opened this issue Oct 10, 2023 · 1 comment
Open

How to correctly inject config? #1330

ntarocco opened this issue Oct 10, 2023 · 1 comment
Labels

Comments

@ntarocco
Copy link

I am experiencing an issue with untrusted content. We are using msgpack for serialization.

I deployed flower in a separate standalone container in our Kubernetes infrastructure, using the image on Docker Hub mher/flower:2.0.

Command:

command:
              [
                "celery",
                "--config=/var/celery/celeryconfig.py",
                "--broker=amqp://<username>:<password>@mq:5672/",
                "flower",
                "--broker_api=http://<username>:<password>@mq:15672/api/",
                "--basic_auth=<basic-auth>",
                "--conf=/var/flower/flowerconfig.py"
              ]

Given the error, I have tried injecting config in various different combinations of this (only one, both, uppercase, prefixed...):

celeryconfig.py: |-
    # looks like not really working
    accept_content = ["json", "msgpack", "yaml"]
    task_serializer = "msgpack"
    result_serializer = "msgpack
flowerconfig.py: |-
    # looks like not really working
    accept_content = ["json", "msgpack", "yaml"]
    task_serializer = "msgpack"
    result_serializer = "msgpack"

The error is always the same:

return self.channels[channel_id].dispatch_method(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/amqp/abstract_channel.py", line 156, in dispatch_method
listener(*args)
File "/usr/local/lib/python3.11/site-packages/amqp/channel.py", line 1629, in _on_basic_deliver
fun(msg)
File "/usr/local/lib/python3.11/site-packages/kombu/messaging.py", line 650, in _receive_callback
decoded = None if on_m else message.decode()
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/kombu/message.py", line 201, in decode
self._decoded_cache = self._decode()
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/kombu/message.py", line 205, in _decode
return loads(self.body, self.content_type,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/kombu/serialization.py", line 255, in loads
raise self._for_untrusted_content(content_type, 'untrusted')
kombu.exceptions.ContentDisallowed: Refusing to deserialize untrusted content of type msgpack (application/x-msgpack)

Am I injecting config in the wrong way?

@ntarocco ntarocco added the bug label Oct 10, 2023
@Andrew-Cha
Copy link

Andrew-Cha commented Apr 17, 2024

Hi, I am also not able to monitor my workers (the error above is identical).

In docker container "My Celery Worker" the celery workers are configured to serialize over pickle.
In another docker container "My Flower Monitoring" the celery flower lives (using the official image).

I am unable to match the config of "My Celery Worker" and "My Flower Monitoring" Celery applications.

What is the accepted solution to configure Flower's Celery instance in the official image?

When Pickle Serializer is used in the worker container (Untrusted Content Error)

image

When the Pickle Serializer is not used in the worker container (Everything works)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants