# Heroku review apps not able to access Elasticsearch add-on foundelasticsearch

**URL:** <https://discuss.elastic.co/t/heroku-review-apps-not-able-to-access-elasticsearch-add-on-foundelasticsearch/314984>\
**Category:** Elasticsearch\
**Created:** [September 23, 2022, 1:10am UTC](https://discuss.elastic.co/t/heroku-review-apps-not-able-to-access-elasticsearch-add-on-foundelasticsearch/314984 "2022-09-23T01:10:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Lee1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_lee1/32/111153_2.png) [@Eric\_Lee1](https://discuss.elastic.co/u/Eric_Lee1)\
**Post date:** [September 23, 2022, 1:10am UTC](https://discuss.elastic.co/t/heroku-review-apps-not-able-to-access-elasticsearch-add-on-foundelasticsearch/314984/1 "2022-09-23T01:10:15Z")

</div>

I am trying to deploy my node application with Elasicsearch and I want to use the official Elasticsearch add-on **foundelasticsearch** into my Heroku application.

Here is my workflow:

1. In my node application, I created a `app.json` for adding the add-on during deployment.  
app.json:

```auto
{
  "name": "<MY_APP>",
  "addons": ["foundelasticsearch:dachs-standard"],
  "environments": {
    "review": {
      "addons": ["foundelasticsearch:dachs-standard"]
    }
  }
}

```

1. I wanted to build a Heroku review apps for testing purpose. So I tried to create a Heroku review app. As the review app was built, the `foundelasticsearch` add-on was created and an `FOUNDELASTICSEARCH_URL` (_https://\<cluster\_id\>.us-east-1.aws.found.io_) was also added to the Heroku config vars.

2. My application is using elastiscsearch client for Javascript (@ elastic/elasticsearch) to connect with the `foundelasticsearch`.  
My code:

```auto
const esClient = new Client({
  node: process.env.FOUNDELASTICSEARCH_URL,
  tls: {
    // required for development
    rejectUnauthorized: false
  }
})

```

1. Because the `FOUNDELASTICSEARCH_URL` does not include the username:password in the url. My application failed to connect and threw an error

```auto
ResponseError: security_exception: [security_exception] Reason: unable to authenticate user [] for REST request

```

My question is how to set up the `foundelasticsearch` properly for Heroku review apps so that my application can access with the credential right after built.

Any suggestion is appreciated. Thanks !

P.s. I also tried to use other add-ons such like `Bonsai` and `Searchbox`. Both `Bonsai` and `Searchbox` would provide the URL in config vars including the username:password, e.g, _[http://username:password@redwood-12345.us-east-1.bonsai.io/](http://username:password@redwood-12345.us-east-1.bonsai.io/)_. I wonder if `foundelasticsearch` would also have something like URL including _username:password_, because I am not able to use `Bonsai` and `Searchbox` for my application since both of those add-ons are not supporting the version of elasticsearch (8.4.0) in my application.

---

<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:** [October 21, 2022, 1:11am UTC](https://discuss.elastic.co/t/heroku-review-apps-not-able-to-access-elasticsearch-add-on-foundelasticsearch/314984/2 "2022-10-21T01:11:02Z")

</div>

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