camunda-community-hub / zeebe-client-node-js

Node.js client library for Zeebe Microservices Orchestration Engine
https://camunda-community-hub.github.io/zeebe-client-node-js/
Apache License 2.0
152 stars 38 forks source link

Unable to connect to an HTTPS endpoint #218

Closed younes-io closed 2 years ago

younes-io commented 3 years ago

Describe the Bug

I have written and run this snippet as Zeebe Modeler uses zeebe-node under the hood:

const zbc = new ZBClient('0.0.0.0:50051', {
    oAuth: {
      url: 'http://127.0.0.1:4000/token',
      audience: '***********************************',
      clientId: '***********************************',
      clientSecret: '****************************************',
      cacheOnDisk: true,
    },
    useTLS: true,
});

Here are the logs:

10:52:30.488 | zeebe | INFO: [topology]: 14 UNAVAILABLE: failed to connect to all addresses E0423 10:52:31.487000000 12952 ssl_transport_security.cc:1245] Handshake failed with fatal error SSL_ERROR_SSL: error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER. 10:52:31.503 | zeebe | INFO: [topology]: Attempt 2 (max: -1). 10:52:31.505 | zeebe | INFO: [topology]: 14 UNAVAILABLE: failed to connect to all addresses 10:52:32.505 | zeebe | INFO: [topology]: Attempt 3 (max: -1). 10:52:32.507 | zeebe | INFO: [topology]: 14 UNAVAILABLE: failed to connect to all addresses E0423 10:52:33.103000000 12952 ssl_transport_security.cc:1245] Handshake failed with fatal error SSL_ERROR_SSL: error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER.

However, when I do useTLS: false, it does work ! I have another endpoint in HTTPS, and it only works when useTLS is set to false, otherwise, I get the error above!

Steps to Reproduce

  1. Open Zeebe Modeler, and pick OAuth
  2. Enter your OAuth credentials
  3. Check Zeebe Modeler logs:
    • Windows: C:\Users\yourUser\AppData\Roaming\zeebe-modeler\Zeebe Modeler\logs\log.log
    • MacOS: ~/Library/Logs/Zeebe Modeler/log.log

Expected Behavior

The same behavior as when the authentication method is set to None.

Environment

jwulf commented 3 years ago

Thanks for reporting this @younes-io.

What version of the zeebe-node library is in the package.json of your project?

younes-io commented 3 years ago

Hello @jwulf ,

In the package.json, I have this "zeebe-node": "^0.23.2"

barmac commented 3 years ago

We've already discussed the issue of fetching token via an insecure, http connection: https://forum.camunda.io/t/an-authentication-issue-in-zeebe-modeler-oauth/2164/6?u=barmac

However, when I do useTLS: false, it does work ! I have another endpoint in HTTPS, and it only works when useTLS is set to false, otherwise, I get the error above!

This might be related to https://github.com/grpc/grpc/issues/9538.

jwulf commented 3 years ago

const zbc = new ZBClient('0.0.0.0:50051', { oAuth: { url: 'http://127.0.0.1:4000/token', audience: '', clientId: '', clientSecret: '****', cacheOnDisk: true, }, useTLS: true, });

I would expect this one to fail, since it is using http. Does this server have TLS enabled?

If it does not, then useTLS: false is the correct setting.

For your endpoint that uses HTTPS (TLS-enabled), you say that it works when you set useTLS: false and fails when you set useTLS: true - is that correct?

younes-io commented 2 years ago

@jwulf I think this can be closed