# Synthetic browser tests are failing in Version 7.x

**URL:** https://discuss.elastic.co/t/synthetic-browser-tests-are-failing-in-version-7-x/324440
**Category:** Synthetics
**Tags:** docker
**Created:** [February 1, 2023, 2:20pm UTC](https://discuss.elastic.co/t/synthetic-browser-tests-are-failing-in-version-7-x/324440 "2023-02-01T14:20:45Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![lawrance.ruban](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@lawrance.ruban](https://discuss.elastic.co/u/lawrance.ruban)
#### Post date: [February 1, 2023, 2:20pm UTC](https://discuss.elastic.co/t/synthetic-browser-tests-are-failing-in-version-7-x/324440/1 "2023-02-01T14:20:45Z")

</div>

We are using 7.16.x ELK version in production and Dev environment and we are running heartbeat docker container v7.17.x for uptime monitoring. The http tests are working but the browser tests are failing with below error. Any work around to fix this issue without upgrading the ELK stack? We tried to upgrade heartbeat docker version to 8.x but thats not compatible with older Elastic search.

docker-elk-heartbeat-1 | 2023-01-31T17:04:55.059Z INFO synthexec/synthexec.go:260 stderr: /tmp/elastic-synthetics-2772323990/node\_modules/@elastic/synthetics/dist/core/runner.js:184docker-elk-heartbeat-1 | 2023-01-31T17:04:55.060Z INFO synthexec/synthexec.go:260 stderr: data.url ??= page.url();docker-elk-heartbeat-1 | 2023-01-31T17:04:55.062Z INFO synthexec/synthexec.go:260 stderr: ^^^docker-elk-heartbeat-1 | 2023-01-31T17:04:55.062Z INFO synthexec/synthexec.go:260 stderr: docker-elk-heartbeat-1 | 2023-01-31T17:04:55.062Z INFO synthexec/synthexec.go:260 stderr: SyntaxError: Unexpected token '??='docker-elk-heartbeat-1 | 2023-01-31T17:04:55.063Z INFO synthexec/synthexec.go:260 stderr: at wrapSafe (internal/modules/cjs/loader.js:988:16)

---

<div class="post-metadata">

### Author: ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)
#### Post date: [February 1, 2023, 4:33pm UTC](https://discuss.elastic.co/t/synthetic-browser-tests-are-failing-in-version-7-x/324440/2 "2023-02-01T16:33:31Z")

</div>

Hi lawrance.ruban,

Syntax error suggests to me a potential version mismatch. You say you tried to upgrade heartbeat. Are you getting this error when you downgraded back down to the original version, or when you upgraded to version 8?

---

<div class="post-metadata">

### Author: ![lawrance.ruban](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@lawrance.ruban](https://discuss.elastic.co/u/lawrance.ruban)
#### Post date: [February 1, 2023, 5:58pm UTC](https://discuss.elastic.co/t/synthetic-browser-tests-are-failing-in-version-7-x/324440/3 "2023-02-01T17:58:23Z")

</div>

I am getting this error with ELK 7.16.x with heartbeat docker 7.17.x. I upgraded the heartbeat docker version to 8.x with allow\_older\_versions = true for elasticsearch in heartbeat.yml config but did not work still. We are getting this error only for browser tests with node package source.

---

<div class="post-metadata">

### Author: ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)
#### Post date: [February 2, 2023, 10:01am UTC](https://discuss.elastic.co/t/synthetic-browser-tests-are-failing-in-version-7-x/324440/4 "2023-02-02T10:01:29Z")

</div>

I assume you're using the @elastic/synthetics package? Would version of that package are you using?

---

<div class="post-metadata">

### Author: ![lawrance.ruban](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@lawrance.ruban](https://discuss.elastic.co/u/lawrance.ruban)
#### Post date: [February 2, 2023, 2:38pm UTC](https://discuss.elastic.co/t/synthetic-browser-tests-are-failing-in-version-7-x/324440/5 "2023-02-02T14:38:22Z")

</div>

Yes the error is from @elastic/synthetics package. We are using @elastic/synthetics": "^1.0.0-beta version. We tried with multiple version within beta versions but didnt help.

---

<div class="post-metadata">

### Author: ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)
#### Post date: [February 2, 2023, 3:52pm UTC](https://discuss.elastic.co/t/synthetic-browser-tests-are-failing-in-version-7-x/324440/6 "2023-02-02T15:52:10Z")

</div>

Thanks for confirming. I've moved this topic to Uptime since the issue is with Synthetics rather than heartbeat.

---

<div class="post-metadata">

### Author: ![vigneshshanmugam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vigneshshanmugam/32/40324_2.png) [@vigneshshanmugam](https://discuss.elastic.co/u/vigneshshanmugam)
#### Post date: [February 2, 2023, 3:54pm UTC](https://discuss.elastic.co/t/synthetic-browser-tests-are-failing-in-version-7-x/324440/7 "2023-02-02T15:54:46Z")

</div>

@lawrance.ruban We have released a lot of code changes to the Synthetics package considering the 8.x stack improvements from Kibana and ES, so it would be possible that there is some breaking changes. Could you help with the following.

1. What is the exact version of Heartbeat?
2. Are you using Inline/Zip/Project based monitors? - [Write a synthetic test | Observability Guide [8.6] | Elastic](https://www.elastic.co/guide/en/observability/current/synthetics-create-test.html)
3. What is the exact version of Synthetics package? beta. ?
4. Would be helpful if you can share your browser test to debug further.

Thanks in advance.

---

<div class="post-metadata">

### Author: ![lawrance.ruban](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@lawrance.ruban](https://discuss.elastic.co/u/lawrance.ruban)
#### Post date: [February 2, 2023, 5:36pm UTC](https://discuss.elastic.co/t/synthetic-browser-tests-are-failing-in-version-7-x/324440/8 "2023-02-02T17:36:35Z")

</div>

ELK stack version : 7.16.3  
Heartbeat docker version : 7.17.4  
Synthetics version : ^1.0.0-beta.40 (tried different versions)  
Monitor type : local type  
heartbeat.yml

```auto
name: heartbeat
setup:
  template.enabled: false
  ilm.enabled: false

heartbeat.monitors:
  - type: browser
    id: elk-basic-test
    name: elk-basic-test
    schedule: '@every 1m'
    throttling: false
    tags:
      - app
    source:
      local:
        path: "${PWD}/config/lsm"
processors:
  - add_cloud_metadata: ~
monitoring:
  enabled: true
output.elasticsearch:
  hosts: [http://elasticsearch:9200]
  username: heartbeat_internal
  password: ${HEARTBEAT_INTERNAL_PASSWORD}
  allow_older_versions: true
  ssl:
    verification_mode: none

```

package.json

```auto
{
  "name": "lsm",
  "version": "1.0.0",
  "description": "lsm synthetic testing",
  "scripts": {
    "test": "npx elastic-synthetics .",
    "debug": "npx elastic-synthetics --no-headless ."
  },
  "license": "ISC",
  "dependencies": {
    "@elastic/synthetics": "^1.0.0-beta.40",
    "playwright": "^1.30.0",
    "playwright-chromium": "^1.30.0",
    "sharp": "^0.30.1"
  }
}

```

demo.journey.ts

```auto
const { journey, step, expect } = require('@elastic/synthetics');
const URL = 'https://elastic-synthetics-demo-ecommerce.vercel.app/';

const navigateToProductDetail = (page, params) => {
  step('visit landing page', async () => {
    await page.goto(params.url || URL, { waitUntil: 'networkidle' });
    // check to make sure all products are loaded
    const productImages = await page.locator('.card img');
    expect(await productImages.count()).toBe(9);
  });

   step('navigate to product detail page', async () => {
      const productImages = await page.locator('.card img');
      const randomCard = Math.floor(
        Math.random() * (await productImages.count())
      );
      await Promise.all([
        page.waitForNavigation({ waitUntil: 'networkidle' }),
        productImages.nth(randomCard).click(),
      ]);
    });
  };

  journey(
    { name: 'Browse products and recommendations flow', tags: ['browse'] },
    ({ page, params }) => {
      navigateToProductDetail(page, params);

      step('look for recommendations', async () => {
        const recommendationsNode = await page.locator(
          'text=Products you might like'
        );
        await recommendationsNode.waitFor({ state: 'visible' });
        // Waits for recommendation product cards
        const recommendedProducts = await page.locator('.container .card');
        expect(await recommendedProducts.count()).toBe(4);
      });
    }
  );

```

Error :  
|docker-elk-heartbeat-1 | 2023-02-02T17:29:26.798Z|INFO|synthexec/synthexec.go:153|Running command: /tmp/elastic-synthetics-2806849855/node\_modules/.bin/elastic-synthetics /tmp/elastic-synthetics-2806849855/node\_modules/.bin/elastic-synthetics /tmp/elastic-synthetics-2806849855 --screenshots on --no-throttling --rich-events in directory: '/tmp/elastic-synthetics-2806849855'|  
|---|---|---|---|  
|docker-elk-heartbeat-1 | 2023-02-02T17:29:26.973Z|INFO|synthexec/synthexec.go:260|stderr: /tmp/elastic-synthetics-2806849855/node\_modules/@elastic/synthetics/dist/core/runner.js:184|  
|docker-elk-heartbeat-1 | 2023-02-02T17:29:26.973Z|INFO|synthexec/synthexec.go:260|stderr: data.url ??= page.url();|  
|docker-elk-heartbeat-1 | 2023-02-02T17:29:26.974Z|INFO|synthexec/synthexec.go:260|stderr: ^^^|  
|docker-elk-heartbeat-1 | 2023-02-02T17:29:26.974Z|INFO|synthexec/synthexec.go:260|stderr: |  
|docker-elk-heartbeat-1 | 2023-02-02T17:29:26.974Z|INFO|synthexec/synthexec.go:260|stderr: SyntaxError: Unexpected token '??='|  
|docker-elk-heartbeat-1 | 2023-02-02T17:29:26.974Z|INFO|synthexec/synthexec.go:260|stderr: at wrapSafe (internal/modules/cjs/loader.js:988:16)|  
|docker-elk-heartbeat-1 | 2023-02-02T17:29:26.974Z|INFO|synthexec/synthexec.go:260|stderr: at Module.\_compile (internal/modules/cjs/loader.js:1036:27)|  
|docker-elk-heartbeat-1 | 2023-02-02T17:29:26.974Z|INFO|synthexec/synthexec.go:260|stderr: at Object.Module.\_extensions..js (internal/modules/cjs/loader.js:1101:10)|  
|docker-elk-heartbeat-1 | 2023-02-02T17:29:26.974Z|INFO|synthexec/synthexec.go:260|stderr: at Module.load (internal/modules/cjs/loader.js:937:32)|  
|docker-elk-heartbeat-1 | 2023-02-02T17:29:26.974Z|INFO|synthexec/synthexec.go:260|stderr: at Function.Module.\_load (internal/modules/cjs/loader.js:778:12)|  
|docker-elk-heartbeat-1 | 2023-02-02T17:29:26.975Z|INFO|synthexec/synthexec.go:260|stderr: at Module.require (internal/modules/cjs/loader.js:961:19)|  
|docker-elk-heartbeat-1 | 2023-02-02T17:29:26.975Z|INFO|synthexec/synthexec.go:260|stderr: at require (internal/modules/cjs/helpers.js:92:18)|  
|docker-elk-heartbeat-1 | 2023-02-02T17:29:26.975Z|INFO|synthexec/synthexec.go:260|stderr: at Object. (/tmp/elastic-synthetics-2806849855/node\_modules/@elastic/synthetics/dist/core/index.js:32:34)|

---

<div class="post-metadata">

### Author: ![vigneshshanmugam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vigneshshanmugam/32/40324_2.png) [@vigneshshanmugam](https://discuss.elastic.co/u/vigneshshanmugam)
#### Post date: [February 2, 2023, 7:35pm UTC](https://discuss.elastic.co/t/synthetic-browser-tests-are-failing-in-version-7-x/324440/9 "2023-02-02T19:35:23Z")

</div>

Thanks for the detailed response.

The node version that the HB stack 7.17.x is running is `14.x` which lacks some of the features and why we are seeing this `SyntaxError`.

I am checking if there is anyway we can backport this change. But unfortunately, you would have to wait for the next patch release of the Elastic Stack. The alternative option is to move to `8.x` release version and try using projected based monitors - [Create monitors with Project Monitors | Observability Guide [8.6] | Elastic](https://www.elastic.co/guide/en/observability/current/synthetics-get-started-project.html) which runs on our SAAS infrastructure.

Thanks,  
Vignesh

---

<div class="post-metadata">

### Author: ![vigneshshanmugam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vigneshshanmugam/32/40324_2.png) [@vigneshshanmugam](https://discuss.elastic.co/u/vigneshshanmugam)
#### Post date: [February 2, 2023, 8:29pm UTC](https://discuss.elastic.co/t/synthetic-browser-tests-are-failing-in-version-7-x/324440/10 "2023-02-02T20:29:04Z")

</div>

@lawrance.ruban

Have you tried with older version of the Synthetics agent ?

```auto
"@elastic/synthetics": "=1.0.0-beta.38",

```

Something like this?

Thanks,  
Vignesh

---

<div class="post-metadata">

### Author: ![lawrance.ruban](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@lawrance.ruban](https://discuss.elastic.co/u/lawrance.ruban)
#### Post date: [February 2, 2023, 8:42pm UTC](https://discuss.elastic.co/t/synthetic-browser-tests-are-failing-in-version-7-x/324440/11 "2023-02-02T20:42:21Z")

</div>

@vigneshshanmugam Thanks for the prompt response. Is there a workaround to use HB 8.x version with our existing ELK stack 7.16.x (runs on ELK SAAS infrastructure) or If we inject the newer Node version from our custom docker image to 7.17.x HB docker, will it work?

---

<div class="post-metadata">

### Author: ![lawrance.ruban](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@lawrance.ruban](https://discuss.elastic.co/u/lawrance.ruban)
#### Post date: [February 2, 2023, 8:43pm UTC](https://discuss.elastic.co/t/synthetic-browser-tests-are-failing-in-version-7-x/324440/12 "2023-02-02T20:43:02Z")

</div>

Tried other versions, Didnt try 38. Will try and see if that works.

---

<div class="post-metadata">

### Author: ![lawrance.ruban](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@lawrance.ruban](https://discuss.elastic.co/u/lawrance.ruban)
#### Post date: [February 2, 2023, 9:57pm UTC](https://discuss.elastic.co/t/synthetic-browser-tests-are-failing-in-version-7-x/324440/13 "2023-02-02T21:57:02Z")

</div>

Same error with 1.0.0-beta.38 also

---

<div class="post-metadata">

### Author: ![vigneshshanmugam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vigneshshanmugam/32/40324_2.png) [@vigneshshanmugam](https://discuss.elastic.co/u/vigneshshanmugam)
#### Post date: [February 2, 2023, 10:03pm UTC](https://discuss.elastic.co/t/synthetic-browser-tests-are-failing-in-version-7-x/324440/14 "2023-02-02T22:03:04Z")

</div>

Did you try pinning the exact version, meaning `=1.0.0.beta.38` in your `package.json` file instead of `^1.0.0.beta-38`?

If the above doesnt help, Does installing globally inside the image `npm i -g @elastic/synthetics@v1.0.0-beta.38` help?

Thanks,  
Vignesh

---

<div class="post-metadata">

### Author: ![lawrance.ruban](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@lawrance.ruban](https://discuss.elastic.co/u/lawrance.ruban)
#### Post date: [February 2, 2023, 11:55pm UTC](https://discuss.elastic.co/t/synthetic-browser-tests-are-failing-in-version-7-x/324440/15 "2023-02-02T23:55:44Z")

</div>

@vigneshshanmugam First of all thanks for the prompt response really appreciate it .The version 38 did not fix it. Actually older version 26 did the trick.

"@elastic/synthetics": "=1.0.0-beta.26",

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 3, 2023, 1:55am UTC](https://discuss.elastic.co/t/synthetic-browser-tests-are-failing-in-version-7-x/324440/16 "2023-03-03T01:55:49Z")

</div>

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