I have in my cluster some microservices that use NestJs and they work perfectly with elasticsearch in https without any certificate. Now I create a NodeJs express microservice where I'm connecting in the same way, but I get always the error
ERROR reloadAllVariables ConnectionError: write EPROTO 140419788733768:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:
at ClientRequest.onError (/app/node_modules/@elastic/elasticsearch/lib/Connection.js:123:16)
at ClientRequest.emit (events.js:400:28)
at TLSSocket.socketErrorListener (_http_client.js:475:9)
at TLSSocket.emit (events.js:400:28)
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
meta: {
body: null,
statusCode: null,
headers: null,
meta: {
context: null,
request: [Object],
name: 'elasticsearch-js',
connection: [Object],
attempts: 3,
aborted: false
}
}
}
using the code:
import { Client } from '@elastic/elasticsearch';
this.client = new Client({
node: 'https://myhost:9200',
auth: {
username: 'elastic',
password: elasticSecret,
},
ssl: {
rejectUnauthorized: false
},
});
any suggestion? I won't use the certificate
packages:
"@elastic/elasticsearch": "^7.16.0",
"typescript": "^4.5.2"
"express": "^4.17.1",