Nginx 502 bad gateway

Hey all :wave:,

I deployed a Django application with a PostgreSQL database on Qovery and it works pretty well.

In my Django app, I have Redis and Celery running (in the same service).
Redis is used for caching and as a message broker for Celery.

I want to set up Redis as an independent service on Qovery.

I created the Redis Database using Qovery and configured my Django settings accordingly:
=> Providing celery and caching service with Redis location:
redis://:{REDIS_PASSWORD}@{REDIS_HOST}:{REDIS_PORT}

:warning: Problem:
When making a request to an endpoint that uses Redis and Celery, I get a “502 Bad Gateway” nginx error.
For example, I have an instrumentsCSV endpoint that passes a .csv to a celery worker that reads the file.

Here are the logs:

{
“created_at”: 1693485880698,
“message”: “2023/08/31 12:44:40 [warn] 245#245: *1408255 a client request body is buffered to a temporary file /tmp/nginx/client-body/0000000019, client: 80.11.4.182, server: api.XXX.io, request: "POST /c/demo/api/instrumentsCSV/ HTTP/1.1", host: "api.XXX.io"”,
“id”: 1030
},
{
“created_at”: 1693485911801,
“pod_name”: “app-zdd090148-webapp-7d8cbb6b65-j9vkv”,
“message”: “[2023-08-31 12:45:11 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:43)”,
“version”: “f357c9dca45c9e99e94f9bd0d43bcf2070a07240”,
“id”: 70
},
{
“created_at”: 1693485911802,
“pod_name”: “app-zdd090148-webapp-7d8cbb6b65-j9vkv”,
“message”: “[2023-08-31 12:45:11 +0000] [43] [INFO] Worker exiting (pid: 43)”,
“version”: “f357c9dca45c9e99e94f9bd0d43bcf2070a07240”,
“id”: 71
},
{
“created_at”: 1693485911802,
“message”: “2023/08/31 12:45:11 [error] 245#245: *1408255 upstream prematurely closed connection while reading response header from upstream, client: 80.11.4.182, server: api.XXX.io, request: "POST /c/demo/api/instrumentsCSV/ HTTP/1.1", upstream: "http://10.42.0.39:8000/c/demo/api/instrumentsCSV/\”, host: "api.XXX.io"",
“id”: 1031
},
{
“created_at”: 1693485911802,
“message”: “80.11.4.182 - - [31/Aug/2023:12:45:11 +0000] "POST /c/demo/api/instrumentsCSV/ HTTP/1.1" 502 150 "-" "PostmanRuntime/7.32.3" 107122 31.354 [env-zc7879a7a-XXX-app-zdd090148-webapp-8000] 10.42.0.39:8000 0 30.218 502 10c6b2b295b26c2c778c0b99c5b19a61”,
“id”: 1032
}

I am not sure where the issue is coming from.
Any idea of what could be causing this error?