Skip to content

Conversation

@JPeer264
Copy link
Member

@JPeer264 JPeer264 commented Nov 27, 2025

This removes node-fetch entirely. We could have upgrade to node-fetch@3, but this one requires ESM-only, which we can't support (we still need CJS support for our @sentry/* bundler packages).

With this PR we use now undici which also has a ProxyAgent included, so we got rid of https-proxy-agent as well.

Closes #1810
Closes CLI-25

@JPeer264 JPeer264 requested review from a team as code owners November 27, 2025 14:59
@JPeer264 JPeer264 requested review from Lms24 and removed request for a team November 27, 2025 14:59
@JPeer264 JPeer264 force-pushed the jp/upgrade-node-fetch branch from b341615 to 99bef89 Compare November 27, 2025 15:04
@JPeer264 JPeer264 added the v3.0 Breaking changes to include in version 3.0.0 of Sentry CLI label Dec 1, 2025
@JPeer264 JPeer264 force-pushed the jp/upgrade-node-fetch branch from 15cb52d to 0c9cd59 Compare December 2, 2025 13:06
Comment on lines +278 to 283
// Check if we have a total size to validate against
if (totalBytes > 0 && downloadedBytes < totalBytes) {
reject(new Error('connection interrupted'));
} else {
resolve();
}

This comment was marked as outdated.

CHANGELOG.md Outdated

### Internal changes

- Removed `node-fetch` dependency when using the NPM package ([#2993](https://github.com/getsentry/sentry-cli/pull/2993))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Removed `node-fetch` dependency when using the NPM package ([#2993](https://github.com/getsentry/sentry-cli/pull/2993))
- Removed `node-fetch` and `https-proxy-agent` dependencies when using the NPM package ([#2993](https://github.com/getsentry/sentry-cli/pull/2993))

@linear
Copy link

linear bot commented Dec 2, 2025

CHANGELOG.md Outdated
Comment on lines 61 to 63
### Internal changes

- Removed `node-fetch` dependency when using the NPM package ([#2993](https://github.com/getsentry/sentry-cli/pull/2993))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is an internal change, we should not include it in the changelog imo.

Suggested change
### Internal changes
- Removed `node-fetch` dependency when using the NPM package ([#2993](https://github.com/getsentry/sentry-cli/pull/2993))

I would also update the PR title from feat: to ref:, as it is not really a new feature from the user perspective. And, that way, the DangerJS action will not complain about a missing changelog entry, since changelog entries are not required for ref: PRs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it and renamed the PR

@JPeer264 JPeer264 changed the title feat: use undici to download binary ref: use undici to download binary Dec 4, 2025
@JPeer264 JPeer264 changed the title ref: use undici to download binary ref: Use undici to download binary Dec 4, 2025
Comment on lines +277 to 284
.on('finish', () => {
// Check if we have a total size to validate against
if (totalBytes > 0 && downloadedBytes < totalBytes) {
reject(new Error('connection interrupted'));
} else {
resolve();
}
});

This comment was marked as outdated.

@szokeasaurusrex szokeasaurusrex removed request for a team and Lms24 December 10, 2025 14:21
Comment on lines +277 to 283
.on('finish', () => {
// Check if we have a total size to validate against
if (totalBytes > 0 && downloadedBytes < totalBytes) {
reject(new Error('connection interrupted'));
} else {
resolve();
}

This comment was marked as outdated.

@szokeasaurusrex szokeasaurusrex force-pushed the jp/move-to-native-typescript branch from c7f20b7 to d0453c4 Compare December 11, 2025 09:59
@szokeasaurusrex szokeasaurusrex force-pushed the jp/move-to-native-typescript branch from d0453c4 to 2c953fe Compare December 11, 2025 13:44
szokeasaurusrex pushed a commit that referenced this pull request Dec 11, 2025
This removes `node-fetch` entirely. We could have upgrade to `node-fetch@3`, but this one requires ESM-only, which we can't support (we still need CJS support for our `@sentry/*` bundler packages).

With this PR we use now `undici` which also has a `ProxyAgent` included, so we got rid of `https-proxy-agent` as well.

Closes #1810
Closes [CLI-25](https://linear.app/getsentry/issue/CLI-25/upgrade-to-node-fetch-v3-to-avoid-punycode-deprecation-warning)
szokeasaurusrex pushed a commit that referenced this pull request Dec 11, 2025
This removes `node-fetch` entirely. We could have upgrade to `node-fetch@3`, but this one requires ESM-only, which we can't support (we still need CJS support for our `@sentry/*` bundler packages).

With this PR we use now `undici` which also has a `ProxyAgent` included, so we got rid of `https-proxy-agent` as well.

Closes #1810
Closes [CLI-25](https://linear.app/getsentry/issue/CLI-25/upgrade-to-node-fetch-v3-to-avoid-punycode-deprecation-warning)
@szokeasaurusrex szokeasaurusrex force-pushed the jp/move-to-native-typescript branch from 2c953fe to 98e6185 Compare December 11, 2025 16:10
@szokeasaurusrex szokeasaurusrex force-pushed the jp/move-to-native-typescript branch from 98e6185 to 6b32ed2 Compare December 11, 2025 16:25
@szokeasaurusrex szokeasaurusrex force-pushed the jp/move-to-native-typescript branch from 6b32ed2 to 3679dc2 Compare December 11, 2025 17:20
@szokeasaurusrex szokeasaurusrex force-pushed the jp/upgrade-node-fetch branch 2 times, most recently from 5529ca5 to 7a09a4e Compare December 12, 2025 12:04
This removes `node-fetch` entirely. We could have upgrade to `node-fetch@3`, but this one requires ESM-only, which we can't support (we still need CJS support for our `@sentry/*` bundler packages).

With this PR we use now `undici` which also has a `ProxyAgent` included, so we got rid of `https-proxy-agent` as well.

Closes #1810
Closes [CLI-25](https://linear.app/getsentry/issue/CLI-25/upgrade-to-node-fetch-v3-to-avoid-punycode-deprecation-warning)
@szokeasaurusrex szokeasaurusrex force-pushed the jp/move-to-native-typescript branch from 0f60c1c to e06b170 Compare December 15, 2025 10:41
} else {
resolve();
}
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Download integrity check unreliable with compressed responses

The connection interrupted check compares downloadedBytes against totalBytes to detect truncated downloads. However, with undici's transparent decompression, downloadedBytes counts decompressed bytes while totalBytes may still be the compressed content-length (undici preserves this header). If a connection interrupts mid-transfer but enough compressed data was already received to decompress to more bytes than the compressed size, the check downloadedBytes < totalBytes evaluates to false, causing the download to be incorrectly accepted as complete. The old code avoided this by setting compress: false and tracking compressed bytes. While checksum validation provides a safety net, users who set SENTRYCLI_SKIP_CHECKSUM_VALIDATION=1 lose protection against corrupted downloads in this scenario.

Additional Locations (1)

Fix in Cursor Fix in Web

Base automatically changed from jp/move-to-native-typescript to master December 15, 2025 11:58
@szokeasaurusrex szokeasaurusrex merged commit aa1e54c into master Dec 15, 2025
38 of 41 checks passed
@szokeasaurusrex szokeasaurusrex deleted the jp/upgrade-node-fetch branch December 15, 2025 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v3.0 Breaking changes to include in version 3.0.0 of Sentry CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade to node-fetch v3 to avoid punycode deprecation warning

4 participants