File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -146,6 +146,25 @@ jobs:
146146 - name : Install Bitwarden CLI
147147 run : npm install -g @bitwarden/cli@2026.6.0
148148
149+ # FIXME Temporary workaround for PM-39403: server >= 2026.6.1 returns responses
150+ # that node-fetch v2 treats as a premature close (ERR_STREAM_PREMATURE_CLOSE),
151+ # even though the response body is fully delivered. Neutralize the two
152+ # `new Error('Premature close')` emission sites in the CLI's bundled
153+ # node-fetch so seed:vault:ciphers can proceed. Remove this step once
154+ # PM-39403 ships and the lite image is rebuilt with the fix.
155+ - name : Patch @bitwarden/cli node-fetch (PM-39403 workaround)
156+ run : |
157+ NF=$(npm root -g)/@bitwarden/cli/node_modules/node-fetch/lib/index.js
158+ BEFORE=$(grep -c "Premature close" "$NF" || echo 0)
159+ # Each match is followed by `err.code = ...` and an emit/callback
160+ # line; delete the 3-line body, leaving the surrounding `if` empty.
161+ sed -i "/new Error('Premature close')/,+2d" "$NF"
162+ AFTER=$(grep -c "Premature close" "$NF" || echo 0)
163+ echo "node-fetch patch: removed $((BEFORE - AFTER)) of $BEFORE match(es)"
164+ if [ "$AFTER" != "0" ]; then
165+ echo "WARNING: not all Premature-close references removed; @bitwarden/cli's node-fetch may have changed shape"
166+ fi
167+
149168 - name : Install project dependencies
150169 run : |
151170 npm ci
Original file line number Diff line number Diff line change @@ -142,6 +142,25 @@ jobs:
142142 - name : Install Bitwarden CLI
143143 run : npm install -g @bitwarden/cli@2026.6.0
144144
145+ # FIXME Temporary workaround for PM-39403: server >= 2026.6.1 returns responses
146+ # that node-fetch v2 treats as a premature close (ERR_STREAM_PREMATURE_CLOSE),
147+ # even though the response body is fully delivered. Neutralize the two
148+ # `new Error('Premature close')` emission sites in the CLI's bundled
149+ # node-fetch so seed:vault:ciphers can proceed. Remove this step once
150+ # PM-39403 ships and the lite image is rebuilt with the fix.
151+ - name : Patch @bitwarden/cli node-fetch (PM-39403 workaround)
152+ run : |
153+ NF=$(npm root -g)/@bitwarden/cli/node_modules/node-fetch/lib/index.js
154+ BEFORE=$(grep -c "Premature close" "$NF" || echo 0)
155+ # Each match is followed by `err.code = ...` and an emit/callback
156+ # line; delete the 3-line body, leaving the surrounding `if` empty.
157+ sed -i "/new Error('Premature close')/,+2d" "$NF"
158+ AFTER=$(grep -c "Premature close" "$NF" || echo 0)
159+ echo "node-fetch patch: removed $((BEFORE - AFTER)) of $BEFORE match(es)"
160+ if [ "$AFTER" != "0" ]; then
161+ echo "WARNING: not all Premature-close references removed; @bitwarden/cli's node-fetch may have changed shape"
162+ fi
163+
145164 - name : Install project dependencies
146165 run : |
147166 npm ci
You can’t perform that action at this time.
0 commit comments