# Environment variables not working in lightweight monitor

**URL:** <https://discuss.elastic.co/t/environment-variables-not-working-in-lightweight-monitor/374513>\
**Category:** Synthetics\
**Tags:** docker\
**Created:** [February 13, 2025, 3:10pm UTC](https://discuss.elastic.co/t/environment-variables-not-working-in-lightweight-monitor/374513 "2025-02-13T15:10:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![masapr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/masapr/32/141366_2.png) [@masapr](https://discuss.elastic.co/u/masapr)\
**Post date:** [February 13, 2025, 3:10pm UTC](https://discuss.elastic.co/t/environment-variables-not-working-in-lightweight-monitor/374513/1 "2025-02-13T15:10:02Z")

</div>

My lightweight monitor runs in a docker container, where I configured an environment variable `TEST_VARIABLE`. I tried several ways to use this variable, but they all don't work.

Particularly the example [[in the documentation]](https://www.elastic.co/guide/en/observability/current/synthetics-params-secrets.html#synthetics-secrets-sensitive) is not working. Also be aware, that the example does not follow the normal template with

`export default env => {`

I tried to reference the environment variable with `process.env.TEST_VARIABLE` from within the synthetics.config.ts which did not work.

Also I tried referencing the variable directly in my monitor with `$TEST_VARIABLE` or `"$TEST_VARIABLE"` and it did not work.

---

<div class="post-metadata">

**Author:** ![masapr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/masapr/32/141366_2.png) [@masapr](https://discuss.elastic.co/u/masapr)\
**Post date:** [March 7, 2025, 12:53pm UTC](https://discuss.elastic.co/t/environment-variables-not-working-in-lightweight-monitor/374513/2 "2025-03-07T12:53:48Z")

</div>

It would be valuable to get some information on this. Will anyone at Elastic look into this?

---

<div class="post-metadata">

**Author:** ![shahzad31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahzad31/32/51637_2.png) [@shahzad31](https://discuss.elastic.co/u/shahzad31)\
**Post date:** [March 7, 2025, 1:12pm UTC](https://discuss.elastic.co/t/environment-variables-not-working-in-lightweight-monitor/374513/3 "2025-03-07T13:12:09Z")

</div>

@masapr which version of kibana, elastic agent and synthetics agent are you using?

---

<div class="post-metadata">

**Author:** ![masapr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/masapr/32/141366_2.png) [@masapr](https://discuss.elastic.co/u/masapr)\
**Post date:** [March 7, 2025, 1:40pm UTC](https://discuss.elastic.co/t/environment-variables-not-working-in-lightweight-monitor/374513/4 "2025-03-07T13:40:19Z")

</div>

Everything is on 8.13.4 (Elastic, Kibana, synthetic agent)

---

<div class="post-metadata">

**Author:** ![masapr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/masapr/32/141366_2.png) [@masapr](https://discuss.elastic.co/u/masapr)\
**Post date:** [March 26, 2025, 2:40pm UTC](https://discuss.elastic.co/t/environment-variables-not-working-in-lightweight-monitor/374513/5 "2025-03-26T14:40:51Z")

</div>

any new information on this?
