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

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

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

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 or the Elasticsearch Nest module? Can you share what versions of Elasticsearch and versions of the client/ module you're using.

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


export class SearchService {
  constructor(private readonly elasticsearchService: ElasticsearchService) {}


  imports: [
      imports: [ConfigModule],
      useFactory: async (config: ConfigService) =>
      inject: [ConfigService],
  providers: [ElasticsearchModule, SearchService],
  exports: [ElasticsearchModule],
export class SearchModule {}


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

Hi @mohamad_khubayb,

Thanks for confirming. I did find a similar issue 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?

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