From da04b63a5235c42a8882e9944782f20a1863fb74 Mon Sep 17 00:00:00 2001 From: kb-typeform Date: Tue, 24 Mar 2026 16:34:12 +0100 Subject: [PATCH] fix: filter npm warn stderr to unblock Node 24 deploys Yarn 1.x re-injects npm_config_argv into child processes even after unsetting the env var. With npm 10+ (Node 24), this causes 'npm warn Unknown env config' messages on stderr. Jarvis treats any stderr output as a deployment failure, blocking the pipeline. The existing unset approach only clears vars in the parent shell but cannot prevent Yarn from re-injecting them. This commit adds process substitution to filter 'npm warn' lines from stderr while preserving real error output. Affects: frontend-deploy-workflow.yml, frontend-pr-workflow.yml --- .github/workflows/frontend-deploy-workflow.yml | 14 +++++++++----- .github/workflows/frontend-pr-workflow.yml | 13 +++++++++---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/frontend-deploy-workflow.yml b/.github/workflows/frontend-deploy-workflow.yml index 3586cf1..fec336d 100644 --- a/.github/workflows/frontend-deploy-workflow.yml +++ b/.github/workflows/frontend-deploy-workflow.yml @@ -605,16 +605,20 @@ jobs: - name: Deploy to production run: | - # Remove deprecated npm config env vars inherited from the runner environment. - # npm 10+ (Node 20.17+/Node 22+) emits warnings to stderr for these legacy keys, - # and Jarvis treats any stderr output as a deployment failure. - # Using both UPPER and lower-case forms to cover all platforms. + # Fix for Node 24 / npm 10+: deprecated npm config env vars cause warnings on stderr. + # Yarn 1.x re-injects npm_config_argv into child processes even after unset, + # so we must also filter stderr to prevent Jarvis from treating warnings as failures. + # + # Step 1: Unset known deprecated vars from the shell environment. unset NPM_CONFIG_ARGV NPM_CONFIG_VERSION_TAG_PREFIX NPM_CONFIG_VERSION_GIT_MESSAGE \ NPM_CONFIG_VERSION_COMMIT_HOOKS NPM_CONFIG__TYPEFORM_REGISTRY 2>/dev/null || true unset npm_config_argv npm_config_version_tag_prefix npm_config_version_git_message \ npm_config_version_commit_hooks npm_config__typeform_registry 2>/dev/null || true - ${{ inputs.deploy-command }} + # Step 2: Run deploy with stderr filtering to catch any remaining npm warnings + # that get re-injected by Yarn 1.x or read from .npmrc. + # This preserves real errors while stripping only "npm warn" lines. + ${{ inputs.deploy-command }} 2> >(grep -v "^npm warn " >&2) env: # Jarvis debug logging DEBUG: jarvis diff --git a/.github/workflows/frontend-pr-workflow.yml b/.github/workflows/frontend-pr-workflow.yml index e030d83..a44da9f 100644 --- a/.github/workflows/frontend-pr-workflow.yml +++ b/.github/workflows/frontend-pr-workflow.yml @@ -521,15 +521,20 @@ jobs: - name: Deploy preview run: | - # Remove deprecated npm config env vars inherited from the runner environment. - # npm 10+ (Node 20.17+/Node 22+) emits warnings to stderr for these legacy keys, - # and Jarvis treats any stderr output as a deployment failure. + # Fix for Node 24 / npm 10+: deprecated npm config env vars cause warnings on stderr. + # Yarn 1.x re-injects npm_config_argv into child processes even after unset, + # so we must also filter stderr to prevent Jarvis from treating warnings as failures. + # + # Step 1: Unset known deprecated vars from the shell environment. unset NPM_CONFIG_ARGV NPM_CONFIG_VERSION_TAG_PREFIX NPM_CONFIG_VERSION_GIT_MESSAGE \ NPM_CONFIG_VERSION_COMMIT_HOOKS NPM_CONFIG__TYPEFORM_REGISTRY 2>/dev/null || true unset npm_config_argv npm_config_version_tag_prefix npm_config_version_git_message \ npm_config_version_commit_hooks npm_config__typeform_registry 2>/dev/null || true - ${{ inputs.deploy-command }} + # Step 2: Run deploy with stderr filtering to catch any remaining npm warnings + # that get re-injected by Yarn 1.x or read from .npmrc. + # This preserves real errors while stripping only "npm warn" lines. + ${{ inputs.deploy-command }} 2> >(grep -v "^npm warn " >&2) env: DEBUG: jarvis GH_TOKEN: ${{ secrets.GH_TOKEN }}