Hi All,
I'm testing out the npx @elastic/synthetics push
command, but I'm running into a few issues, and was wondering if anyone has any ideas on how to fix them.
- Push command doesn't respect NodeJS TLS settings.
I have Kibana behind a HTTPS with the cert being signed by a private CA. I'm trying to run the push command, but continuously get the error
Error: unable to get local issuer certificate
at TLSSocket.onConnectSecure (node:_tls_wrap:1530:34)
at TLSSocket.emit (node:events:390:28)
at TLSSocket._finishInit (node:_tls_wrap:944:8)
at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:725:12) {
code: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY'
}
I attempt 2 workarounds, but neither worked:
set NODE_TLS_REJECT_UNAUTHORIZED=0
npm config set strict-ssl false
An interesting note. The above settings work for the npx @elastic/synthetics init
command. So, I suspect the issue is specific to the push
command.
- Lightweight monitors seem to expect to be in a file called
heartbeat.yml
I would like to be able to have a project structure like:
lightweight/
ICMP.yml
TCP.yml
HTTP.yml
An example of the contents of ICMP.yml
heartbeat.monitors:
- type: icmp
name: google.com
id: google
enabled: true
hosts: ["google.com."]
schedule: "@every 20s"
Then run a push command which only deploys a single file to a set of locations, using the --pattern
option:
npx @elastic/synthetics push --auth <token> --url <url> --id icmp --space default --private-locations 'ICMP' --pattern "lightweight/ICMP.yml"
But when I run the above command, I get the following error:
C:\...\lightweight\ICMP.yml:1
heartbeat.monitors:
^
SyntaxError: Unexpected token ':'
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1025:15)
at Module._compile (node:internal/modules/cjs/loader:1059:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1147:10)
at Object.newLoader [as .js] (E:\GitHub\monitors\elastic-agents\synthetics\node_modules\pirates\lib\index.js:141:7)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at requireSuites (E:\GitHub\monitors\elastic-agents\synthetics\node_modules\@elastic\synthetics\src\loader.ts:123:5)
Node.js v17.0.1
Switching the file name from ICMP.yml
to heartbeat.yml
clears this error, but then breaks the desired project/file structure.