nodejs / nodejs/node

NODE_EXTRA_CA_CERTS does not work when set in env file

Open
#51,426 11 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

confirmed-bug dotenv
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

Version

v21.5.0

Platform

Darwin MACM-YXGQWMKDQK 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000 arm64

Subsystem

No response

What steps will reproduce the bug?

Run
node --env-file ./config/.env.development

With env file containing NODE_EXTRA_CA_CERTS

The variable is not taken into account.

Run same script but exporting the variable first, it is correctly taken into account.

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

Always!

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

The ca cert should be taken into account

What do you see instead?

It is not correctly taken into account and I get errors about self signed certificates

Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with node --env-file ./config/.env.development and an env file containing NODE_EXTRA_CA_CERTS, then compare it with exporting the variable before running the same script. Done means the certificate is honored when loaded from the env file and the self-signed certificate errors no longer occur.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.