hapijs / hapi

The Simple, Secure Framework Developers Trust

Home Page:https://hapi.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error from remoteAddr if the socket goes away

joshkel opened this issue · comments

Support plan

  • is this issue currently blocking your project? (yes/no): no
  • is this issue affecting a production system? (yes/no): yes

Context

  • node version: 14.21.1
  • module version with issue: 21.0.0
  • last module version without issue: 20.2.2
  • environment (e.g. node, browser, native): Node
  • used with (e.g. hapi application, another framework, standalone, ...): Hapi application
  • any other relevant information:

What are you trying to achieve or the steps to reproduce?

Accessing request.info.remoteAddress may fail if the remote socket has gone away.

This appears to be the result of #4357.

What was the result you got?

TypeError: Cannot read property 'startsWith' of undefined
    at internals.Info.get remoteAddress [as remoteAddress] (/home/deploy/node_modules/@hapi/hapi/lib/request.js:661:31)

What result did you expect?

A successful undefined value

thanks @joshkel - also experiencing this issue. would be great to get the patch in