Synthetics push command issues

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.

  1. 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.

  1. 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.

Hi @BenB196, can you confirm which version of the @elastic/synthetics package that you're using?

Hi @carly.richmond, sure, below is the output of the version command:

npx @elastic/synthetics --version
1.0.0-beta.40

I believe that this is the current latest version from what I could find on GitHub.

if it doesn't allows file name as ICMP.yml, i believe this seems to be a bug. Can you please open an issue in the repo. We will fix it in upcoming release.

cc @vigneshshanmugam

We will test the push command with Kibana behind a HTTPS with the cert being signed by a private CA. Could be an issue as well.

Thanks @shahzad31 I've opened synthetics push command with lightweight monitors doesn't work for files other than heartbeat.yml · Issue #705 · elastic/synthetics · GitHub for this.

1 Like

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