# Unable push the code into elastic journey

**URL:** https://discuss.elastic.co/t/unable-push-the-code-into-elastic-journey/371004
**Category:** Synthetics
**Created:** [November 25, 2024, 4:11am UTC](https://discuss.elastic.co/t/unable-push-the-code-into-elastic-journey/371004 "2024-11-25T04:11:36Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![xyngfei](https://avatars.discourse-cdn.com/v4/letter/x/a88e57/32.png) [@xyngfei](https://discuss.elastic.co/u/xyngfei)
#### Post date: [November 25, 2024, 4:11am UTC](https://discuss.elastic.co/t/unable-push-the-code-into-elastic-journey/371004/1 "2024-11-25T04:11:36Z")

</div>

Follow the example,

> **[synthetics-demo/advanced-examples at main · elastic/synthetics-demo](https://github.com/elastic/synthetics-demo/tree/main/advanced-examples)**
>
> Demo app for elastic/synthetics. Contribute to elastic/synthetics-demo development by creating an account on GitHub.

In the synthetics.config.ts, i have provided the request value

```auto
    project: {
      id: xxx,
      url: xxx,
      space: xxx,
    },

```

Run this command,  
SYNTHETICS\_API\_KEY= npm run push

Why does such an error occur?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/f/2fca8bf51c4c63792f77f466209fe6b37fd9fe23.png)

---

<div class="post-metadata">

### Author: ![jessgarson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jessgarson/32/129841_2.png) [@jessgarson](https://discuss.elastic.co/u/jessgarson)
#### Post date: [November 25, 2024, 5:56pm UTC](https://discuss.elastic.co/t/unable-push-the-code-into-elastic-journey/371004/2 "2024-11-25T17:56:06Z")

</div>

Thanks for reaching out, @xyngfei. The error seems to indicate that the configuration isn't correctly set. I have a few questions here:

- Did you use the wizard to set your your enviroment?

- What directory are you when you run `SYNTHETICS_API_KEY=<value> npm run push`?

I have some resources I've created on this subject [on my GitHub](https://github.com/JessicaGarson/Synthetic-Monitoring-Unpacked) which may be helpful.

---

<div class="post-metadata">

### Author: ![xyngfei](https://avatars.discourse-cdn.com/v4/letter/x/a88e57/32.png) [@xyngfei](https://discuss.elastic.co/u/xyngfei)
#### Post date: [December 3, 2024, 2:11am UTC](https://discuss.elastic.co/t/unable-push-the-code-into-elastic-journey/371004/3 "2024-12-03T02:11:35Z")

</div>

@jessgarson

1. I didn't use the wizard to set on my local enviroment because i need to simualate on the CICD environment with a single command line can push the code the elastic.
2. directory to run the code in same level with the node\_modules folder

```auto
limxf@xf-lim-mml85 cmp-journey % ls
README.md journeys output package.json synthetics.
cred.txt node_modules package-lock.json pages utils
limxf@xf-lim-mml85 cmp-journey % SYNTHETICS_API_KEY=<key> DEBUG=synthetics npm run push

> elastic-synthetic-journeys@1.0.0 push
> npx @elastic/synthetics push --yes

at 6361 ms Processing file: xxx/journeys/journey.ts
at 7049 ms Journey register: "Journey"
env: development
Aborted (missing synthetics config file), Project not set up correctly.

Run 'npx @elastic/synthetics init' to create project with default settings.

```

Somehow when I used the same push command, it can work well on the CICD environment. It is puzzling me a lot

---

<div class="post-metadata">

### Author: ![xyngfei](https://avatars.discourse-cdn.com/v4/letter/x/a88e57/32.png) [@xyngfei](https://discuss.elastic.co/u/xyngfei)
#### Post date: [December 3, 2024, 2:30am UTC](https://discuss.elastic.co/t/unable-push-the-code-into-elastic-journey/371004/4 "2024-12-03T02:30:11Z")

</div>

If I don't install @elastic/synthetics globally, only under node\_module folder, and trigger the following command to push, by right, it should work?

```auto
npx @elastic/synthetics push --yes

```

---

<div class="post-metadata">

### Author: ![jessgarson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jessgarson/32/129841_2.png) [@jessgarson](https://discuss.elastic.co/u/jessgarson)
#### Post date: [December 3, 2024, 10:05pm UTC](https://discuss.elastic.co/t/unable-push-the-code-into-elastic-journey/371004/5 "2024-12-03T22:05:02Z")

</div>

Thanks for following up, @xyngfei. What CI/CD enviorment are you using?

For something like GitHub actions, you can use a YAML file that would look something like this:

```auto
on: [push]

jobs:
  setup_synthetics:
    runs-on: ubuntu-latest
    steps:
    - name: Check out repository
      uses: actions/checkout@v2

    - name: Set up Node.js
      uses: actions/setup-node@v3
      with:
        node-version: '16'  

    - name: Install Elastic Synthetics
      run: npm install -g @elastic/synthetics

    - name: Initialize Synthetics
      run: npx @elastic/synthetics init ${{ github.event.repository.name }}

```

---

<div class="post-metadata">

### Author: ![xyngfei](https://avatars.discourse-cdn.com/v4/letter/x/a88e57/32.png) [@xyngfei](https://discuss.elastic.co/u/xyngfei)
#### Post date: [December 4, 2024, 2:56am UTC](https://discuss.elastic.co/t/unable-push-the-code-into-elastic-journey/371004/6 "2024-12-04T02:56:43Z")

</div>

@jessgarson

Yes, I noticed that our GitLab runner has installed the synthetics globally, that is the reason it can run successfully on the CICD pipeline.

besides, I also made a mistake, I didn't setup the environment file properly due to the code issue.

I appreciate your speedy reply and solution to address this issue.

---

<div class="post-metadata">

### Author: ![jessgarson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jessgarson/32/129841_2.png) [@jessgarson](https://discuss.elastic.co/u/jessgarson)
#### Post date: [December 4, 2024, 3:15am UTC](https://discuss.elastic.co/t/unable-push-the-code-into-elastic-journey/371004/7 "2024-12-04T03:15:00Z")

</div>

Thanks, @xyngfei. Do you need any further support here, or should I mark this sloved?

---

<div class="post-metadata">

### Author: ![xyngfei](https://avatars.discourse-cdn.com/v4/letter/x/a88e57/32.png) [@xyngfei](https://discuss.elastic.co/u/xyngfei)
#### Post date: [December 4, 2024, 3:18am UTC](https://discuss.elastic.co/t/unable-push-the-code-into-elastic-journey/371004/8 "2024-12-04T03:18:25Z")

</div>

@jessgarson yes, you can mark it as solved 🙂
