TanmoySG / logsmith-monitor

A centralized log monitoring server
4 stars 0 forks source link

[Bug Fix] Handle "Mid-flight" Crashing due to node-fetch error in NodeJS Helper Library #52

Closed TanmoySG closed 2 years ago

TanmoySG commented 2 years ago

Describe the bug

To Reproduce Steps to reproduce the behavior:

  1. Run Monitor, in the main project directory - node .
  2. In a separate terminal, Go to ./libraries/js/examples
  3. Run the Example Server node . , should be running in localhost:8096
  4. In another terminal , using cURL request to the example app endpoint and publish sample logs - curl localhost:8096/warn
  5. Publishes sample logs
  6. Now, in the terminal where monitor is running, stop the monitor using ctrl+c
  7. Now try publishing the sample logs again curl localhost:8096/warn
  8. This throws an error and stops the example app and it crashes.
  9. The error: image

Expected behavior Should be catching the FetchError and handle it, instead of causing the app to crash.

Additional context Another related issue with a similar context- #50