My program always reports this error. What's the reason for this

Hi there! :wave:

I can help you understand this error. You’re encountering a 504 Gateway Timeout error, which is a known issue when using Camunda 8 with nginx as a reverse proxy.

Root Cause

The error occurs because:

  • nginx doesn’t support HTTP/2 keepalive pings that are required for long-lived gRPC streams (like job streaming)
  • nginx closes idle connections, causing your worker to receive 504 Gateway Timeout errors when trying to activate jobs
  • This results in the io.grpc.StatusRuntimeException: UNAVAILABLE you’re seeing

Solution

You have two main options to fix this:

Option 1: Configure Stream Timeout (Recommended)

Configure both your Camunda worker and nginx with appropriate timeouts:

In your Camunda worker (Java client):

zeebe:
  client:
    default-job-worker-stream-enabled: true
    # Set stream timeout to 1 hour
    stream-timeout: PT1H

In nginx configuration:

grpc_send_timeout 70m;  # Slightly higher than worker stream timeout

Option 2: Disable Job Streaming

If you can’t modify nginx configuration, you can disable job streaming and use polling instead:

zeebe:
  client:
    default-job-worker-stream-enabled: false

Note: This may increase latency and is not recommended for high-throughput scenarios.

Additional Information

To help you better, could you please provide:

  • Your Camunda version (format: major.minor.patch)
  • Are you using Camunda SaaS or Self-Managed?
  • Are you using nginx as a reverse proxy in your setup?

References

Let me know if you need help implementing any of these solutions!