REST Basic Auth - External Worker

Hi Team,

Just wanted consult if anyone had any success in enabling Basic Auth for External Workers? Indicated below are the components of my environment:

Camunda distro: Platform Run ver 7.16
Java: JDK-11
External Worker: Python Script (python 3.9)

Current state: when I enabled HTTPS in Platform Run using the production.yml, suddenly my external worker that is currently subscribed to a topic on a service task stopped ingesting data. It still works on HTTP, but I can’t figure out why it’s not working on HTTPS. I did try in postman and it worked when I entered a username and password using basic auth.

I’m not sure if I’m missing a configuration while following the docs but here’s what I have as of the moment in terms of application code and configuration:

production.yml

camunda.bpm.run.auth.enabled: true
camunda.bpm.run.authorization.enabled: true

Note: the rest of the config is the default contents included in the production.yml file.

External Worker App

For the external worker, I constructed my script using the guide in this link: camunda-external-task-client-python3 · PyPI

import logging
import os

from camunda.external_task.external_task import ExternalTask, TaskResult
from camunda.external_task.external_task_worker import ExternalTaskWorker

from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
from urllib.parse import quote, unquote_plus
from …

def handle_task(task: ExternalTask) → TaskResult:

"""
This task handler you need to implement with your business logic.
After completion of business logic call either
task.complete() or task.failure() or task.bpmn_error()
to report status of task to Camunda
"""
// my business logic here

return task.complete({"status": "success"})

if name == “main”:
create_logger(logger_name, “wk-taskList”)
logger.info(f"Camunda Worker with ID: {WORKER_ID} started")
ExternalTaskWorker(worker_id=WORKER_ID, config=WORKER_CONFIG).subscribe(
WORKER_TOPIC, handle_task
)

my configurations are referenced in/imported from another file called config.py (hence the 'from config import *)

WORKER_CONFIG = {
“auth_basic”: {“username”: “demo”, “password”: “demo”},
“maxTasks”: 1,
“lockDuration”: 10000,
“asyncResponseTimeout”: 5000,
“retries”: 3,
“retryTimeout”: 5000,
“sleepSeconds”: 30
}
WORKER_TOPIC = “No_STR”
WORKER_ID = “1”

Thanks!

*I did try submitting a process-instance in postman and it worked (meaning I can access the API) when I entered a username and password using basic auth.

Just to add as well, when I checked logs for Camunda Run or my external task worker, there are no logs, it’s as if nothing is happening or they are not seeing each other. thank you!!!