DEV Community

AmasiaNalbandian
AmasiaNalbandian

Posted on

Never Ending Errors

You know how when you try to avoid a problem for a while, it turns into a bigger one? Well last week we barely made a scratch on the surface for the search bar:

This week I did a rebase for the branch. This rebase was for 10 separate commits. I am not a fan or rebasing and having conflicts. This means I am a new fan of continuously updating my branches with the latest code in master.

Although I was finally able to rebase the branch(also incorrectly), I was now presented with a new problem... or should I say error:

TypeError: Cannot set property statusCode of Error which has only a getter
    at createError (/app/node_modules/http-errors/index.js:101:33)
    at /app/src/routes/query.js:13:10
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
{
  error: ResponseError: index_not_found_exception
      at onBody (/app/node_modules/@elastic/elasticsearch/lib/Transport.js:337:23)
      at IncomingMessage.onEnd (/app/node_modules/@elastic/elasticsearch/lib/Transport.js:264:11)
      at IncomingMessage.emit (node:events:402:35)
      at endReadableNT (node:internal/streams/readable:1343:12)
      at processTicksAndRejections (node:internal/process/task_queues:83:21) {
    meta: {
      body: [Object],
      statusCode: 404,
      headers: [Object],
      meta: [Object]
    }
  }
} query error
Enter fullscreen mode Exit fullscreen mode

The problem was foreshadowed in my blog last week:

I was unable to get the port for the queries working, so once I solve that, I will be able to get the inputs working.

I was able to come up with a work around. What has happened was ever since we finally had the tests created for ElasticSearch, we ripped out the functionality from Telescope, to use Satellite for ElasticSearch. This has caused some issues with the port it listens to. I believe the correct port to use now is localhost, but I am not too confident this will work on staging. I asked Dave if the error only shows up for him locally, and he confirmed, so it seems when we run our containers locally, we are trying to connect to 127.0.0.1 port 9200 for Elasticsearch, but this is not correct as we have migrated over to Satellite to provide us the Client.

The fix that seemed to work and avoid the error, seems to be able to query properly locally, however, I wasn't able to reproduce the error to write in the PR the proof of it working. I'll have to spend some time on this this week.

Elasticsearch progress

  • Added title in search UI
  • Added back the useEffect for the search so it is more interactive (populate search as you update fields)
  • Hooked up the API calls for Search from the front-end (we can search by titles! - more to come!)

Remaining work

  • Tie up all the search input fields
  • Remove code from the old search
  • Clean up the UI
  • Any other bugs that I am probably not expecting...

Top comments (0)