Skip to content

Prints long stack trace in error log when a non-existing route is hit

Is this a BUG REPORT or FEATURE REQUEST

  • BUG Report
  • Feature request

What happened

info: 01b7eac5-56c6-4fd3-a7bd-4dfcd4f52a42 ::1 - - [09/Oct/2018:07:35:20 +0000] "GET /some-random-non-existing-route HTTP/1.1" 404 3376 "-" "curl/7.54.0"

Error: Not Found
    at app.use (/Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/@apifie/node-microservice/index.js:338:17)
    at Layer.handle [as handle_request] (/Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/index.js:317:13)
    at /Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/index.js:335:12)
    at next (/Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/index.js:275:10)
    at /Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/index.js:635:15
    at next (/Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/index.js:260:14)
    at Function.handle (/Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/index.js:174:3)
    at router (/Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/index.js:47:12)
    at Layer.handle [as handle_request] (/Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/index.js:317:13)
    at /Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/index.js:335:12)
    at next (/Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/index.js:275:10)
    at /Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/index.js:635:15
    at next (/Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/index.js:260:14)
    at Function.handle (/Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/index.js:174:3)
    at router (/Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/index.js:47:12)
    at Layer.handle [as handle_request] (/Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/index.js:317:13)
    at /Users/diwakar/Projects/apifie/full-feature-micro-service-example/node_modules/express/lib/router/index.js:284:7

What you expected to happen

I expect it to not print such a huge stack trace for 404. A single error log is enough. Too much logs just for 404 spam the console and logging platform.

How to reproduce it (as minimally and precisely as possible)

  1. start the service
  2. curl localhost:3000/some-random-non-existing-route

Anything else we need to know?

xxxxx

Environment

  • @apifie/node-microservice version : 1.0.3
  • NodeJS version (node -v) : v8.12.0
  • npm version (npm -v) : 6.4.1
  • Others
    • Database (MySQL) version
    • Message Queue (MQ) version
    • Cache (Redis) version
    • Others : xxxxx
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information