Polling failed with RequestError: self-signed certificate

Hi,

I am trying to complete external tasks with camunda-external-task-client-js and Camunda Run. Camunda Run is running in production mode. For this reason I am using BasicAuthInterceptor to make connection with basic authentication.

However, getting error because of self-signed certificate. Logs are down below.

[nodemon] 2.0.22
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node index.js`
✓ subscribed to topic KurulTopic
✖ polling failed with RequestError: self-signed certificate
✖ polling failed with RequestError: self-signed certificate
✖ polling failed with RequestError: self-signed certificate
✖ polling failed with RequestError: self-signed certificate
✖ polling failed with RequestError: self-signed certificate

I am using code on the below.

import { Client,BasicAuthInterceptor, logger } from "camunda-external-task-client-js";


const basicAuthentication  = new BasicAuthInterceptor({
    username: "mert",
    password: "Mahan12345*"
  });

const client = new Client({
    baseUrl: "https://localhost:8443/engine-rest",
    interceptors: basicAuthentication,
    use: logger,
    asyncResponseTimeout: 30000,
    workerId: "id" + Math.random().toString(16).slice(2),
    maxTasks: 100,
    maxParallelExecutions: 100,  
});

client.subscribe("KurulTopic", async (task, taskService) =>{
  console.log("Started");
  await taskService.complete(task);
  console.log("finished");
});

I tried to add certificate to Windows as trusted, but nothing changed.
Thanks for any help.

In my scenario I solved by adding certificate as environment variable.
For anyone looking how to add certificate as environment variable, command is down below for Windows.

set NODE_EXTRA_CA_CERTS=path_your_cert_file

After this command I restarted index.js and it works!

image

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.