Sitelet https://github.com/nodejs/node/issues/49839
Skip to content

Internal error in http2 with checkServerIdentity undefined #49839

Description

@martenrichter

Version

v18.18.0

Platform

Linux 3eaa088c9827 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 GNU/Linux

Subsystem

http2

What steps will reproduce the bug?

It happened with:

  this.clientInt = connect('https://' + +this.hostname + ':' + this.port, {
      settings: {
        enableConnectProtocol: true
      },
      checkServerIdentity,
      localPort: this.localPort
    })

Important is that checkServerIdentity is undefined.

It says then:

Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues

    at new NodeError (node:internal/errors:405:5)
    at assert (node:internal/assert:14:11)
    at Object.connect (node:_tls_wrap:1684:3)
    at connect (node:internal/http2/core:3298:22)
    at Http2WebTransportClient.createTransport (file:///workspaces/webtransport/lib/http2/client.js:57:22)
    at HttpClient.transportIntSwitchToReliable (file:///workspaces/webtransport/lib/transport.js:129:35)
    at file:///workspaces/webtransport/lib/webtransport.js:70:18 {
  code: 'ERR_INTERNAL_ASSERTION'
}

and I am just filling it, since node.js asked me to.
I assume it can be easily worked around by not having checkServerIdentity in the object, when not used.

How often does it reproduce? Is there a required condition?

Always.

What is the expected behavior? Why is that the expected behavior?

Ignore the setting

What do you see instead?

The trace above.

Additional information

No response

Activity

  1. ishan-18 commented on Sep 26, 2023

    @ishan-18

    Try doing this:
    `const options = {
    settings: {
    enableConnectProtocol: true
    },
    localPort: this.localPort
    };

    if (checkServerIdentity) {
    options.checkServerIdentity = checkServerIdentity;
    }

    this.clientInt = connect('https://' + this.hostname + ':' + this.port, options);
    `

  2. martenrichter commented on Sep 27, 2023

    @martenrichter
    ContributorAuthor

    Thanks, of course, I did something like this. But as I wrote, I just filed the issue, as node.js asked me too. ("Please open an issue with this stack trace at") I assume, that the intention is, that it is either correctly handled or an meaningful error is thrown.

  3. deokjinkim commented on Sep 30, 2023

    @deokjinkim
    Contributor

    @martenrichter Thank you for your report. As you mentioned, need to throw ERR_INVALID_ARG_TYPE instead of ERR_INTERNAL_ASSERTION for this case. I created PR(#49896).

  4. added
    http2Issues and PRs related to the http2 subsystem.
    on Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    http2Issues and PRs related to the http2 subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions