# ERROR \[ExceptionHandler\] Cannot read properties of undefined (reading 'cloud')

**URL:** <https://discuss.elastic.co/t/error-exceptionhandler-cannot-read-properties-of-undefined-reading-cloud/337436>\
**Category:** Elasticsearch\
**Created:** [July 3, 2023, 10:08am UTC](https://discuss.elastic.co/t/error-exceptionhandler-cannot-read-properties-of-undefined-reading-cloud/337436 "2023-07-03T10:08:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohamad\_khubayb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohamad_khubayb/32/122939_2.png) [@mohamad\_khubayb](https://discuss.elastic.co/u/mohamad_khubayb)\
**Post date:** [July 3, 2023, 10:08am UTC](https://discuss.elastic.co/t/error-exceptionhandler-cannot-read-properties-of-undefined-reading-cloud/337436/1 "2023-07-03T10:08:58Z")

</div>

I'm trying to use `ElasticSearch` in a `NestJs` project.

`The problem is after setting up everything I getting this error:`

 ![2023-07-03_09-27](https://us1.discourse-cdn.com/elastic/original/3X/c/2/c27424244a431bb7f5945bfa0d6fdad4a2a82e4a.png)

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [July 3, 2023, 10:11am UTC](https://discuss.elastic.co/t/error-exceptionhandler-cannot-read-properties-of-undefined-reading-cloud/337436/2 "2023-07-03T10:11:12Z")

</div>

Hi @mohamad_khubayb,

Welcome to the community! Can you explain how you are interacting with Elasticsearch in your Nest application? Are you using the [Elasticsearch JavaScript client](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html) or the [Elasticsearch Nest module](https://github.com/nestjs/elasticsearch)? Can you share what versions of Elasticsearch and versions of the client/ module you're using.

---

<div class="post-metadata">

**Author:** ![mohamad\_khubayb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohamad_khubayb/32/122939_2.png) [@mohamad\_khubayb](https://discuss.elastic.co/u/mohamad_khubayb)\
**Post date:** [July 3, 2023, 12:59pm UTC](https://discuss.elastic.co/t/error-exceptionhandler-cannot-read-properties-of-undefined-reading-cloud/337436/3 "2023-07-03T12:59:59Z")

</div>

@carly.richmond Using Elasticsearch Nest module. Here's the files:

search.service.ts

```auto
@Injectable()
export class SearchService {
  constructor(private readonly elasticsearchService: ElasticsearchService) {}
}

```

search.module.ts

```auto
@Module({
  imports: [
    ConfigModule,
    ElasticsearchModule.registerAsync({
      imports: [ConfigModule],
      useFactory: async (config: ConfigService) =>
        ConfigSearch.searchConfig(config.get('ELASTIC_SEARCH_URL')),
      inject: [ConfigService],
    }),
  ],
  providers: [ElasticsearchModule, SearchService],
  exports: [ElasticsearchModule],
})
export class SearchModule {}

```

search,config.ts

```auto
export class ConfigSearch {
  public static searchConfig(url: string): any {
    return {
      node: url,
      maxRetries: 5,
      requestTimeout: 60000,
      sniffOnStart: true,
    };
  }
}

```

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [July 3, 2023, 3:09pm UTC](https://discuss.elastic.co/t/error-exceptionhandler-cannot-read-properties-of-undefined-reading-cloud/337436/4 "2023-07-03T15:09:09Z")

</div>

Hi @mohamad_khubayb,

Thanks for confirming. I did find a [similar issue](https://github.com/nestjs/elasticsearch/issues/1017) on the Nest module repo that recommends discussing in their Discord. Have you checked to see if a potential answer to the issue is in there?

---

<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:** [July 31, 2023, 3:10pm UTC](https://discuss.elastic.co/t/error-exceptionhandler-cannot-read-properties-of-undefined-reading-cloud/337436/5 "2023-07-31T15:10:02Z")

</div>

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