Skip to content

Payload timeout must be shorter than socket timeout #4122

@kobelb

Description

@kobelb

Support plan

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

Context

  • node version: v12.9.0
  • module version with issue: @hapi/hapi 19.2.0
  • last module version without issue: N/A
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): standalone
  • any other relevant information:

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

Configuring a route with route.options.timeout.socket smaller than route.options.payload.timeout

 server.route({
        method: 'POST',
        path: '/',
        options: {
            payload: {
                timeout: 1000
            },
            timeout: {
                socket: 200
            }
        },
        handler: (request, h) => {
            return 'Hello World!';
        }
    });

What was the result you got?

Causes the following error to be throw:

AssertionError [ERR_ASSERTION]: Payload timeout must be shorter than socket timeout

What result did you expect?

I expected to be able to configure the route.options.timeout.socket to be smaller than route.options.payload.timeout. The payload timeout controls the total payload reception time; where-as route.options.timeout.socket is actually the "idle socket timeout", not the "total time socket is open timeout". For example, we should be able to configure the payload to be sent within 1 second, while ensuring that the socket isn't idle for 500ms during the entire duration of the request and response.

Metadata

Metadata

Assignees

No one assigned

    Labels

    supportQuestions, discussions, and general support

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions