# Elasticsearch API throwing ValueError in PROD, fine in DEV/QAT

**URL:** <https://discuss.elastic.co/t/elasticsearch-api-throwing-valueerror-in-prod-fine-in-dev-qat/310796>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [July 27, 2022, 8:37pm UTC](https://discuss.elastic.co/t/elasticsearch-api-throwing-valueerror-in-prod-fine-in-dev-qat/310796 "2022-07-27T20:37:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TravisCanCode604](https://avatars.discourse-cdn.com/v4/letter/t/77aa72/32.png) [@TravisCanCode604](https://discuss.elastic.co/u/TravisCanCode604)\
**Post date:** [July 27, 2022, 8:37pm UTC](https://discuss.elastic.co/t/elasticsearch-api-throwing-valueerror-in-prod-fine-in-dev-qat/310796/1 "2022-07-27T20:37:38Z")

</div>

Hi there,

I'm experiencing an issue with the Python packages elasticsearch and elastic\_transport in an OCP cluster. The code I'm using works in DEV and QAT environments but throws this error in PROD:

```auto
Traceback (most recent call last):
  File "src/update_watchers.py", line 18, in <module>
    es = ElasticResource(config)
  File "/app/src/utils/elastic_resources.py", line 29, in __init__
    config['elastic']['password']))
  File "/usr/local/miniconda/lib/python3.7/site-packages/elasticsearch/_sync/client/ __init__.py", line 399, in __init__
    **transport_kwargs,
  File "/usr/local/miniconda/lib/python3.7/site-packages/elastic_transport/_transport.py", line 233, in __init__
    **node_pool_kwargs,
  File "/usr/local/miniconda/lib/python3.7/site-packages/elastic_transport/_node_pool.py", line 180, in __init__
    raise ValueError("Cannot use duplicate NodeConfigs within a NodePool")
ValueError: Cannot use duplicate NodeConfigs within a NodePool

```

The file src/update\_watchers.py is my code where I am trying to instantiate the class on line 18.

Python package versions are:

- elastic-transport 8.1.2
- elasticsearch 8.2.3

Has anyone encountered this type of issue before? I'm perplexed as to why it would work in the lower environments but not in PROD when it's the same codebase. Should I consider raising an issue on GitHub?

This is my code where I am trying to instantiate the class:

update\_watchers.py

```auto
env = resolve_env(os.getenv('KUBERNETES_NAMESPACE'))
 
config = {
  'elastic' : {
    'username' : os.getenv('ELASTIC_USERNAME'),
    'password' : os.getenv('ELASTIC_PASSWORD')
  }
}

es = ElasticResource(config)

```

elastic\_resource.py

```auto
class ElasticResource():
    def __init__ (self, config):
      self.config = config
 
      self.es = Elasticsearch(
        elastic_url,
        basic_auth=(config['elastic']['username'],
        config['elastic']['password']))

```

---

<div class="post-metadata">

**Author:** ![TravisCanCode604](https://avatars.discourse-cdn.com/v4/letter/t/77aa72/32.png) [@TravisCanCode604](https://discuss.elastic.co/u/TravisCanCode604)\
**Post date:** [July 29, 2022, 2:27am UTC](https://discuss.elastic.co/t/elasticsearch-api-throwing-valueerror-in-prod-fine-in-dev-qat/310796/2 "2022-07-29T02:27:06Z")

</div>

Resolved the issue - the API and server versions did not match.

---

<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:** [August 26, 2022, 2:27am UTC](https://discuss.elastic.co/t/elasticsearch-api-throwing-valueerror-in-prod-fine-in-dev-qat/310796/3 "2022-08-26T02:27:54Z")

</div>

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