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

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:
{
  "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:

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

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