hapijs / hapi-pino

🌲 Hapi plugin for the Pino logger
MIT License
148 stars 61 forks source link

Not handling correctly `request.url` when inject an invalid URL #113

Closed rtrys closed 4 years ago

rtrys commented 4 years ago

We recently had a problem with hapi-pino, because hapi is unable to create the request.url object when the URL is invalid, see this gist

Related to #102

rtrys commented 4 years ago

the node process is crashing when it happens, here are logs

TypeError [ERR_INVALID_URL]: Invalid URL: http://:80/(a%7Cb).loclhost:80a/
    at onParseError (internal/url.js:257:9)
    at new URL (internal/url.js:333:5)
    at Request._parseUrl (/Users/huortiz/dev/plat/consumer-apps-ol/node_modules/@hapi/hapi/lib/request.js:180:25)
    at Request.get url [as url] (/Users/huortiz/dev/plat/consumer-apps-ol/node_modules/@hapi/hapi/lib/request.js:114:21)
    at isLoggingIgnored (/Users/huortiz/dev/plat/consumer-apps-ol/node_modules/hapi-pino/index.js:176:40)
    at /Users/huortiz/dev/plat/consumer-apps-ol/node_modules/hapi-pino/index.js:87:9
    at exports.Manager.execute (/Users/huortiz/dev/plat/consumer-apps-ol/node_modules/@hapi/hapi/lib/toolkit.js:57:29)
    at Request._invoke (/Users/huortiz/dev/plat/consumer-apps-ol/node_modules/@hapi/hapi/lib/request.js:391:55)
    at Request._onRequest (/Users/huortiz/dev/plat/consumer-apps-ol/node_modules/@hapi/hapi/lib/request.js:282:41)
    at Request._execute (/Users/huortiz/dev/plat/consumer-apps-ol/node_modules/@hapi/hapi/lib/request.js:264:24)