Uploaded image for project: 'BookBrainz'
  1. BookBrainz
  2. BB-760

When elasticsearch configuration is missing, server crashes

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • None
    • None
    • None
    • None

      During server maintenance, we rebooted the server BB is running on.
      The elasticsearch services didn't come back online automatically for some reason, which in term created an issue with consul configuration template:
      The whole elasticsearch section of the config was empty, and the server code was crashing repeatedly on startup in quick succession with this error:

       

      Uncaught Exception:
      ConfigurationError: Missing node(s) option
          at new Client (/home/bookbrainz/bookbrainz-site/node_modules/@elastic/elasticsearch/index.js:46:13)
          at _callee12$ (/home/bookbrainz/bookbrainz-site/lib/common/helpers/search.js:802:23)
          at tryCatch (/home/bookbrainz/bookbrainz-site/node_modules/regenerator-runtime/runtime.js:63:40)
          at Generator.invoke [as _invoke] (/home/bookbrainz/bookbrainz-site/node_modules/regenerator-runtime/runtime.js:294:22)
          at Generator.next (/home/bookbrainz/bookbrainz-site/node_modules/regenerator-runtime/runtime.js:119:21)
          at asyncGeneratorStep (/home/bookbrainz/bookbrainz-site/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
          at _next (/home/bookbrainz/bookbrainz-site/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
          at /home/bookbrainz/bookbrainz-site/node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7
          at new Promise (<anonymous>)
          at Object.<anonymous> (/home/bookbrainz/bookbrainz-site/node_modules/@babel/runtime/helpers/asyncToGenerator.js:21:12)
          at Object._init (/home/bookbrainz/bookbrainz-site/lib/common/helpers/search.js:830:16)
      About to exit with code: 1
          at Object.init (/home/bookbrainz/bookbrainz-site/lib/common/helpers/search.js:790:16)
          at Object.<anonymous> (/home/bookbrainz/bookbrainz-site/lib/server/app.js:110:8)
          at Module._compile (node:internal/modules/cjs/loader:1105:14)
          at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
          at Module.load (node:internal/modules/cjs/loader:981:32)
      2023-08-01T16:05:47.723Z [ERR] (cli) child process died with exit code 1
      
      

       

      The server should be more resilient and treat the absence of a search configuration to set a banner on the website to tell users search is not working, but still bring up the server !

       

            Ta.Run Tarun
            mr_monkey Monkey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                Version Package