Unable to connect to elasticsearch instance running on non-root path
See original GitHub issue🐛 Bug Report
I’m unable to connect to elasticsearch instance running on non-root path, in my case /elastic
. This is due to this function in Undici that does not allow non-root paths. Might be related to #1625 but not sure so opening a new issue.
To Reproduce
const client = new Client({
node: "http://secret.com/elastic",
auth: {
username: "admin",
password: "admin",
},
});
Expected behavior
I would love to be able to connect to an Elasticsearch instance that is hidden behind a k8s ingress.
Output:
InvalidArgumentError: invalid url
at Object.parseOrigin (/workspace/node_modules/undici/lib/core/util.js:83:11)
at new Pool (/workspace/node_modules/undici/lib/pool.js:62:23)
at new Connection (/workspace/node_modules/@elastic/transport/src/connection/UndiciConnection.ts:113:17)
at WeightedConnectionPool.createConnection (/workspace/node_modules/@elastic/transport/src/pool/BaseConnectionPool.ts:133:24)
at WeightedConnectionPool.addConnection (/workspace/node_modules/@elastic/transport/src/pool/BaseConnectionPool.ts:158:53)
at new Client (/workspace/node_modules/@elastic/elasticsearch/src/client.ts:231:27)
at /workspace/src/server.ts:26:18
at Generator.next (<anonymous>)
at /workspace/src/server.ts:8:71
at new Promise (<anonymous>)
at __awaiter (/workspace/src/server.ts:4:12)
at init (/workspace/src/server.ts:23:12)
at Object.<anonymous> (/workspace/src/index.ts:3:5)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Module.m._compile (/workspace/node_modules/ts-node/src/index.ts:1455:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1159:10) {
code: 'UND_ERR_INVALID_ARG'
}
Your Environment
- node version: 18
@elastic/elasticsearch
8.2.1- os: Linux
Issue Analytics
- State:
- Created a year ago
- Reactions:5
- Comments:5
Top Results From Across the Web
Unable to connect to Elasticsearch - Elastic Discuss
After enabling xpack in elasticsearch.yml i am geting the below error in kibana. [image]
Read more >Creating an Elastic search image. Issue with non-root user ...
1 and shows you each step of the image build (in other words, the dockerfile that built that image) and the base image...
Read more >How To Install and Configure Elasticsearch on Ubuntu 18.04
This article will guide you through installing Elasticsearch, configuring it for your use case, securing your installation, and beginning to ...
Read more >Unable to connect to Elasticsearch instance in Spectrum 12
When Spectrum 12.0 is installed fresh / upgraded from previous release, the Spectrum server will not start. The wrapper.log file indicates the following ......
Read more >The Kubernetes executor for GitLab Runner
You cannot use several services using the same port (e.g., you cannot ... This example creates a user and group called nonroot and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@sheikalthaf No. Fortunately for me I experienced this in a small proof-of-concept so I just did the raw http-request via axios instead of using the client lib in the meantime
@delvedor @karatekaneen I’m too facing the same issue. Any workaround here?