Skip to content

[Bug]: Python + RabbitMQ trigger: empty event #3701

Description

@jlechalu-ellona

Nuclio Version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of Nuclio.

Issue Description

When running an empty function using python3.11 and rabbitmq trigger, the event is always empty regardless of the rabbitmq message.

test.py:

import nuclio_sdk

# Main function
def handler(context: nuclio_sdk.Context, event: nuclio_sdk.Event):
	context.logger.info(f"Received event {event}")
	return "Did stuff"

Function Dockerfile:

## NUCLIO Base image for Python 3.12
ARG NUCLIO_LABEL=1.14.6
ARG NUCLIO_ARCH=amd64
ARG NUCLIO_BASE_IMAGE=python:3.11
ARG NUCLIO_ONBUILD_IMAGE=quay.io/nuclio/handler-builder-python-onbuild:${NUCLIO_LABEL}-${NUCLIO_ARCH}

FROM nuclio/uhttpc:0.0.1-amd64 AS uhttpc
FROM ${NUCLIO_ONBUILD_IMAGE} AS processor
FROM ${NUCLIO_BASE_IMAGE}

COPY --from=processor /home/nuclio/bin/processor /usr/local/bin/processor
COPY --from=processor /home/nuclio/bin/py /opt/nuclio/
COPY --from=processor /home/nuclio/bin/py*-whl/* /opt/nuclio/whl/
COPY --from=uhttpc /home/nuclio/bin/uhttpc /usr/local/bin/uhttpc

RUN python /opt/nuclio/whl/$(basename /opt/nuclio/whl/pip-*.whl)/pip install pip --no-index --find-links /opt/nuclio/whl \
 && python -m pip install six nuclio-sdk msgpack --no-index --find-links /opt/nuclio/whl

HEALTHCHECK --interval=1s --timeout=3s CMD /usr/local/bin/uhttpc --url http://127.0.0.1:8082/ready || exit 1

# Function code
COPY ./functions/test /opt/nuclio

# Function requirements
RUN python -m pip install -r /opt/nuclio/requirements.txt

## NUCLIO function start
CMD [ "processor" ]

function.yaml:

apiVersion: "nuclio.io/v1"
kind: NuclioFunction
metadata:
  name: test
  namespace: nuclio 
  labels:
    nuclio.io/project-name: default
spec:
  image: <myregistry>.io/test:latest
  runtime: python:3.11
  handler: test:handler
  minReplicas: 1
  platform:
    attributes:
      healthCheckInterval: 10s
  triggers:
    http:
      kind: http
    rabbitmq:
      kind: "rabbit-mq"
      url: "amqp://user:password@rabbitmq.namespace.svc:5672/"
      attributes:
        exchangeName: "someExchange"
        reconnectDuration: "10m"
        reconnectInterval: "5s"
        prefetchCount: 1
        durableExchange: true
        durableQueue: true

Pod log:

25.07.08 14:32:16.307 (I) .connection-manager.event Received event {"body": null, "content_type": "", "trigger": {"kind": "rabbitMq", "name": "rabbitmq"}, "fields": {}, "headers": {}, "id": "", "method": "", "path": "/", "size": 0, "timestamp": "0001-01-01 00:00:00", "url": "", "shard_id": -1, "num_shards": 0, "type": "", "type_version": "", "version": "", "last_in_batch": false, "offset": 0, "topic": ""}
... // Runing infinetely without acking the RabbitMQ message

Expected Behavior

Having the rabbitmq message in event.body and other event fields completed.

Deployment Method

Kubernetes

Nuclio Version

1.14.6

Additional Information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions