PostgreSQL Connector Docker trying to connect to wrong Operate URL and Port

Using the following configuration to start the PostgreSQL Connector but the log shows it failing to connect to Operate, and is using a different URL:Port from the container configurations.

docker run --rm --name=postgresql-connector
-v $PWD/target/connector-postgresql-0.1.0-SNAPSHOT-with-dependencies.jar:/opt/app/connector.jar
–network=camunda-platform_camunda-platform
-e ZEEBE_CLIENT_BROKER_GATEWAY-ADDRESS=zeebe:26500
-e ZEEBE_CLIENT_SECURITY_PLAINTEXT=true
-e ZEEBE_CLIENT_ID=zeebe
-e ZEEBE_CLIENT_SECRET=zecret
-e ZEEBE_CLIENT_CONFIG_PATH=/tmp/zeebe_auth_cache
-e ZEEBE_TOKEN_AUDIENCE=zeebe-api
-e ZEEBE_AUTHORIZATION_SERVER_URL=http://keycloak:8080/auth/realms/camunda-platform/protocol/openid-connect/token
-e CAMUNDA_IDENTITY_TYPE=KEYCLOAK
-e CAMUNDA_IDENTITY_AUDIENCE=operate-api
-e CAMUNDA_IDENTITY_ISSUER_BACKEND_URL=http://keycloak:8080/auth/realms/camunda-platform
-e CAMUNDA_IDENTITY_CLIENT_ID=connectors
-e CAMUNDA_IDENTITY_CLIENT_SECRET=XALaRPl5qwTEItdwCMiPS62nVpKs7dL7
-e CAMUNDA_OPERATE_CLIENT_URL=http://operate:8080
postgresql-connector

Log Shows:

2024-03-26T03:36:59.356Z WARN 1 — [ main] s.c.c.OperateClientProdAutoConfiguration : An attempt to connect to Operate failed: io.camunda.operate.exception.OperateException: org.apache.hc.client5.http.HttpHostConnectException: Connect to http://localhost:18080 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused

Why is it trying to connect to localhost:18080???

Hello @bjmacd ,

could you please try to set CAMUNDA_IDENTITY_ISSUER to the same value as CAMUNDA_IDENTITY_ISSUER_BACKEND_URL?

If this does not help, we will have to review which properties are applied to the Operate client for authentication.

Jonathan

Hi Jonathan
Thanks for the quick reply. I added the following with the same result.

-e CAMUNDA_IDENTITY_ISSUER=http://keycloak:8080/auth/realms/camunda-platform

BTW … I am using Camunda 8

Hello @bjmacd ,

The connector environement variables look correct based on documentation provided

could you mention the camunda 8 version and the connectors version of the Image

Along with @jonathan.lukas suggestion

Please check with your network name and the version compatibility of connector with your cluster

Based on History for connector-postgresql - Infosys/camunda-connectors · GitHub the version is 8.3.1

1 Like

For the Camunda Dockers …

CAMUNDA_CONNECTORS_VERSION=8.5.0-alpha2
CAMUNDA_PLATFORM_VERSION=8.5.0-alpha1

Hello @bjmacd,

I have tried to recreate the issue you are facing with the configuration and able to reproduce it with the configuration

2024-03-27 10:14:56 2024-03-27T04:44:56.247Z ERROR 1 --- [   scheduling-1] i.c.common.auth.SimpleAuthentication     : Authenticating for OPERATE failed due to org.apache.hc.client5.http.HttpHostConnectException: Connect to http://localhost:18080 [localhost/127.0.0.1] failed: Connection refused
2024-03-27 10:14:56 2024-03-27T04:44:56.248Z ERROR 1 --- [   scheduling-1] o.s.s.s.TaskUtils$LoggingErrorHandler    : Unexpected error occurred in scheduled task
2024-03-27 10:14:56 
2024-03-27 10:14:56 java.lang.RuntimeException: Unable to authenticate
2024-03-27 10:14:56     at io.camunda.common.auth.SimpleAuthentication.retrieveToken(SimpleAuthentication.java:73)
2024-03-27 10:14:56     at io.camunda.common.auth.SimpleAuthentication.getTokenHeader(SimpleAuthentication.java:86)
2024-03-27 10:14:56     at io.camunda.common.http.DefaultHttpClient.retrieveToken(DefaultHttpClient.java:184)
2024-03-27 10:14:56     at io.camunda.common.http.DefaultHttpClient.post(DefaultHttpClient.java:138)
2024-03-27 10:14:56     at io.camunda.operate.CamundaOperateClient.searchProcessDefinitionResults(CamundaOperateClient.java:46)
2024-03-27 10:14:56     at io.camunda.connector.runtime.inbound.importer.ProcessDefinitionSearch.query(ProcessDefinitionSearch.java:64)
2024-03-27 10:14:56     at io.camunda.connector.runtime.inbound.importer.ProcessDefinitionImporter.scheduleImport(ProcessDefinitionImporter.java:52)
2024-03-27 10:14:56     at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
2024-03-27 10:14:56     at java.base/java.lang.reflect.Method.invoke(Unknown Source)
2024-03-27 10:14:56     at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84)
2024-03-27 10:14:56     at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
2024-03-27 10:14:56     at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
2024-03-27 10:14:56     at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)
2024-03-27 10:14:56     at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
2024-03-27 10:14:56     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
2024-03-27 10:14:56     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
2024-03-27 10:14:56     at java.base/java.lang.Thread.run(Unknown Source)
2024-03-27 10:14:56 Caused by: org.apache.hc.client5.http.HttpHostConnectException: Connect to http://localhost:18080 [localhost/127.0.0.1] failed: Connection refused
2024-03-27 10:14:56     at java.base/sun.nio.ch.Net.pollConnect(Native Method)
2024-03-27 10:14:56     at java.base/sun.nio.ch.Net.pollConnectNow(Unknown Source)
2024-03-27 10:14:56     at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(Unknown Source)
2024-03-27 10:14:56     at java.base/sun.nio.ch.NioSocketImpl.connect(Unknown Source)
2024-03-27 10:14:56     at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
2024-03-27 10:14:56     at java.base/java.net.Socket.connect(Unknown Source)
2024-03-27 10:14:56     at org.apache.hc.client5.http.socket.PlainConnectionSocketFactory.lambda$connectSocket$0(PlainConnectionSocketFactory.java:91)
2024-03-27 10:14:56     at java.base/java.security.AccessController.doPrivileged(Unknown Source)
2024-03-27 10:14:56     at org.apache.hc.client5.http.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:90)
2024-03-27 10:14:56     at org.apache.hc.client5.http.socket.ConnectionSocketFactory.connectSocket(ConnectionSocketFactory.java:123)
2024-03-27 10:14:56     at org.apache.hc.client5.http.impl.io.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:184)
2024-03-27 10:14:56     at org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:447)
2024-03-27 10:14:56     at org.apache.hc.client5.http.impl.classic.InternalExecRuntime.connectEndpoint(InternalExecRuntime.java:162)
2024-03-27 10:14:56     at org.apache.hc.client5.http.impl.classic.InternalExecRuntime.connectEndpoint(InternalExecRuntime.java:172)
2024-03-27 10:14:56     at org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:142)
2024-03-27 10:14:56     at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
2024-03-27 10:14:56     at org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:192)
2024-03-27 10:14:56     at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
2024-03-27 10:14:56     at org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:113)
2024-03-27 10:14:56     at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
2024-03-27 10:14:56     at org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:152)
2024-03-27 10:14:56     at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
2024-03-27 10:14:56     at org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:116)
2024-03-27 10:14:56     at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
2024-03-27 10:14:56     at org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:170)
2024-03-27 10:14:56     at org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:123)
2024-03-27 10:14:56     at io.camunda.common.auth.SimpleAuthentication.retrieveToken(SimpleAuthentication.java:59)
2024-03-27 10:14:56     ... 16 common frames omitted
2024-03-27 10:14:56

The error above says that is due to i.c.common.auth.SimpleAuthentication
And tries to connect localhost which is odd

When I try with disabling the operate connectivity, It works fine