Skip to content

'response' is not defined in .count() catch block causing route crash #7

@Ananya-vastare

Description

@Ananya-vastare

Bug Report: ES Router Issues

Description

In the catch block of the .count() call inside the /all-data-by-free-text route,
the variable response is logged but it was never declared in that scope.
This causes a ReferenceError at runtime whenever the .count() call fails.

Location

router.get("/all-data-by-free-text", ...)

Buggy Code

.catch((exp) => {
  console.debug("check free data exp")
  console.debug(response)
  handleCountResponse(res)
})

Fix

.catch((exp) => {
  console.debug("check free data exp")
  console.debug(exp)
  handleCountResponse(res)
})

Impact

  • Severity: Critical
  • Crashes the route handler whenever the Elasticsearch .count() call fails
  • Returns no meaningful error to the client

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions