Skip to content

--ca-file options seems to be broken with Node >= 12 #33492

Closed
@vhiairrassary

Description

@vhiairrassary

Preliminary Checks

Description

--ca-file is used to set NODE_EXTRA_CA_CERTS at

process.env.NODE_EXTRA_CA_CERTS = caFile
? absoluteOrDirectory(directory, caFile)
: certPath

But NODE_EXTRA_CA_CERTS
must not be set at runtime: https://nodejs.org/api/cli.html#cli_node_extra_ca_certs_file (and it is loaded at startup since node 12, see nodejs/node#23354).

We don't know exactly why we had this regression (node upgrade, Gatsby 3 upgrade, ?) but socket.io URL (such as .../8001/socket.io/?EIO=4&transport=polling) was presenting wrong certificate, while regular server is Ok. Manually setting NODE_EXTRA_CA_CERTS fix the issue.

Reproduction Link

Steps to Reproduce

Set --ca-file option

Expected Result

No certificate error on socket.io/?EIO=4&transport=polling URLs

Actual Result

Certificate error on socket.io/?EIO=4&transport=polling URLs

Environment

System:
    OS: macOS 11.6
    CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.22.6 - ~/.nodenv/versions/12.22.6/bin/node
    Yarn: 1.22.11 - ~/.nodenv/versions/12.22.6/bin/yarn
    npm: 6.14.15 - ~/.nodenv/versions/12.22.6/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 94.0.4606.71
    Safari: 15.0
  npmPackages:
    gatsby: ^3.14.2 => 3.14.2
    gatsby-image: ^3.11.0 => 3.11.0
    gatsby-plugin-datadog: ^1.1.1 => 1.1.1
    gatsby-plugin-material-ui: ^3.0.1 => 3.0.1
    gatsby-plugin-offline: ^4.14.0 => 4.14.0
    gatsby-plugin-react-helmet: ^4.14.0 => 4.14.0
    gatsby-plugin-sharp: ^3.14.1 => 3.14.1
    gatsby-plugin-styled-components: ^4.14.0 => 4.14.0
    gatsby-plugin-svgr: ^3.0.0-beta.0 => 3.0.0-beta.0
    gatsby-plugin-use-query-params: ^1.0.1 => 1.0.1
    gatsby-source-filesystem: ^3.14.0 => 3.14.0
    gatsby-transformer-sharp: ^3.14.0 => 3.14.0

Config Flags

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    stale?Issue that may be closed soon due to the original author not responding any more.status: needs reproductionThis issue needs a simplified reproduction of the bug for further troubleshooting.type: bugAn issue or pull request relating to a bug in Gatsby

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions