Skip to content

Commit 11dc761

Browse files
author
Luca Forstner
authored
ref: Remove customHeader option (#167)
1 parent f783689 commit 11dc761

File tree

10 files changed

+11
-65
lines changed

10 files changed

+11
-65
lines changed

MIGRATION.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ Previously, the webpack plugin always injected a `SENTRY_RELEASES` variable into
3838

3939
The purpose of this option is to support module-federated projects or micro frontend setups where multiple projects would want to access the global release variable. However, Sentry SDKs by default never accessed this variable so it would require manual user-intervention to make use of it. Making this behaviour opt-in decreases the bundle size impact of our plugin for the majority of users.
4040

41+
### Removal of the `customHeader` option
42+
43+
The `customHeader` was used to attach an additional header to outgoing requests to Sentry when uploading source maps.
44+
This option has been removed in favor of the `headers` option which allows for attaching multiple headers.
45+
4146
## Upgrading from 0.3.x to 0.4.x
4247

4348
### Replacing default exports with named exports

packages/bundler-plugin-core/src/options-mapping.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ type OptionalInternalOptions = Partial<
2828
| "setCommits"
2929
| "deploy"
3030
| "configFile"
31-
| "customHeader"
3231
| "headers"
3332
>
3433
>;
@@ -97,11 +96,6 @@ export function normalizeUserOptions(userOptions: UserOptions): InternalOptions
9796
// the passed options are undefined.
9897
authToken: userOptions.authToken, // env var: `SENTRY_AUTH_TOKEN`
9998

100-
// CLI v1 (and the "old" webpack plugin) use `CUSTOM_HEADER`,
101-
// but CLI v2 uses `SENTRY_HEADER` (which is also better aligned with other naming)
102-
// In the spirit of maximum compatibility, we allow both here.
103-
customHeader:
104-
userOptions.customHeader ?? process.env["SENTRY_HEADER"] ?? process.env["CUSTOM_HEADER"],
10599
headers: userOptions.headers,
106100

107101
vcsRemote: userOptions.vcsRemote, // env var: `SENTRY_VSC_REMOTE`

packages/bundler-plugin-core/src/sentry/cli.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@ export type SentryCLILike = SentryCli | SentryDryRunCLI;
1515
* that makes no-ops out of most CLI operations
1616
*/
1717
export function getSentryCli(internalOptions: InternalOptions, logger: Logger): SentryCLILike {
18-
const { silent, org, project, authToken, url, vcsRemote, customHeader, headers } =
19-
internalOptions;
18+
const { silent, org, project, authToken, url, vcsRemote, headers } = internalOptions;
2019
const cli = new SentryCli(internalOptions.configFile, {
2120
url,
2221
authToken,
2322
org,
2423
project,
2524
vcsRemote,
2625
silent,
27-
customHeader,
2826
headers,
2927
});
3028

packages/bundler-plugin-core/src/sentry/telemetry.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,7 @@ export function addPluginOptionInformationToHub(
137137
}
138138

139139
export async function shouldSendTelemetry(options: InternalOptions): Promise<boolean> {
140-
const {
141-
silent,
142-
org,
143-
project,
144-
authToken,
145-
url,
146-
vcsRemote,
147-
customHeader,
148-
headers,
149-
telemetry,
150-
dryRun,
151-
} = options;
140+
const { silent, org, project, authToken, url, vcsRemote, headers, telemetry, dryRun } = options;
152141

153142
// `options.telemetry` defaults to true
154143
if (telemetry === false) {
@@ -170,7 +159,6 @@ export async function shouldSendTelemetry(options: InternalOptions): Promise<boo
170159
project,
171160
vcsRemote,
172161
silent,
173-
customHeader,
174162
headers,
175163
});
176164

packages/bundler-plugin-core/src/types.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,8 @@ export type Options = Omit<IncludeEntry, "paths"> & {
108108
*/
109109
vcsRemote?: string;
110110

111-
/**
112-
* A header added to every outgoing network request.
113-
* The format should be `header-key: header-value`.
114-
*
115-
* This value can also be specified via the `CUSTOM_HEADER` environment variable.
116-
*/
117-
customHeader?: string;
118-
119111
/**
120112
* Headers added to every outgoing network request.
121-
* This value does not set any env variable, and is overridden by customHeader.
122113
*/
123114
headers?: Record<string, string>;
124115

packages/bundler-plugin-core/test/option-mappings.test.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -81,32 +81,6 @@ describe("normalizeUserOptions()", () => {
8181
});
8282
});
8383

84-
test("should handle `SENTRY_HEADER` & `CUSTOM_HEADER` env", () => {
85-
const userOptions: Options = {
86-
org: "my-org",
87-
project: "my-project",
88-
authToken: "my-auth-token",
89-
release: "my-release",
90-
include: "./out",
91-
};
92-
93-
const _original_SENTRY_HEADER = process.env["SENTRY_HEADER"];
94-
const _original_CUSTOM_HEADER = process.env["CUSTOM_HEADER"];
95-
96-
expect(normalizeUserOptions(userOptions).customHeader).toBeUndefined();
97-
98-
process.env["CUSTOM_HEADER"] = "custom-header";
99-
100-
expect(normalizeUserOptions(userOptions).customHeader).toBe("custom-header");
101-
102-
process.env["SENTRY_HEADER"] = "sentry-header";
103-
104-
expect(normalizeUserOptions(userOptions).customHeader).toBe("sentry-header");
105-
106-
process.env["SENTRY_HEADER"] = _original_SENTRY_HEADER;
107-
process.env["CUSTOM_HEADER"] = _original_CUSTOM_HEADER;
108-
});
109-
11084
test.each(["https://sentry.io", undefined])(
11185
"should enable telemetry if `telemetry` is true and Sentry SaaS URL (%s) is used",
11286
(url) => {

packages/esbuild-plugin/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ The Sentry Esbuild Plugin takes an options argument with the following propertie
5959
| project | `string` | optional | The slug of the Sentry project associated with the app. Can also be specified via the `SENTRY_PROJECT` environment variable. |
6060
| authToken | `string` | optional | The authentication token to use for all communication with Sentry. Can be obtained from https://sentry.io/settings/account/api/auth-tokens/. Required scopes: `project:releases` (and `org:read` if `setCommits` option is used). Can also be specified via the `SENTRY_AUTH_TOKEN` env variable. |
6161
| url | `string` | optional | The base URL of your Sentry instance. Use this if you are using a self-hosted or Sentry instance other than sentry.io. This value can also be set via the `SENTRY_URL` environment variable. Defaults to https://sentry.io/, which is the correct value for SaaS customers. |
62-
| headers | `Record<string, string>` | optional | Headers added to every outgoing network request. This value does not set any env variable, and is overridden by `customHeader`. |
63-
| customHeader | `string` | optional | A header added to every outgoing network request. The format should be `header-key: header-value`. This value can also be specified via the `CUSTOM_HEADER` environment variable. |
62+
| headers | `Record<string, string>` | optional | Headers added to every outgoing network request. |
6463
| vcsRemote | `string` | optional | Version control system remote name. This value can also be specified via the `SENTRY_VSC_REMOTE` environment variable. Defaults to `'origin'`. |
6564
| release | `string` | optional | Unique identifier for the release. This value can also be specified via the `SENTRY_RELEASE` environment variable. Defaults to the output of the `sentry-cli releases propose-version` command, which automatically detects values for Cordova, Heroku, AWS CodeBuild, CircleCI, Xcode, and Gradle, and otherwise uses the git `HEAD`'s commit SHA. (**the latter requires access to `git` CLI and for the root directory to be a valid repository**). |
6665
| dist | `string` | optional | Unique identifier for the distribution, used to further segment your release. Usually your build number. |

packages/rollup-plugin/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ The Sentry Rollup Plugin takes an options argument with the following properties
5959
| project | `string` | optional | The slug of the Sentry project associated with the app. Can also be specified via the `SENTRY_PROJECT` environment variable. |
6060
| authToken | `string` | optional | The authentication token to use for all communication with Sentry. Can be obtained from https://sentry.io/settings/account/api/auth-tokens/. Required scopes: `project:releases` (and `org:read` if `setCommits` option is used). Can also be specified via the `SENTRY_AUTH_TOKEN` env variable. |
6161
| url | `string` | optional | The base URL of your Sentry instance. Use this if you are using a self-hosted or Sentry instance other than sentry.io. This value can also be set via the `SENTRY_URL` environment variable. Defaults to https://sentry.io/, which is the correct value for SaaS customers. |
62-
| headers | `Record<string, string>` | optional | Headers added to every outgoing network request. This value does not set any env variable, and is overridden by `customHeader`. |
63-
| customHeader | `string` | optional | A header added to every outgoing network request. The format should be `header-key: header-value`. This value can also be specified via the `CUSTOM_HEADER` environment variable. |
62+
| headers | `Record<string, string>` | optional | Headers added to every outgoing network request. |
6463
| vcsRemote | `string` | optional | Version control system remote name. This value can also be specified via the `SENTRY_VSC_REMOTE` environment variable. Defaults to `'origin'`. |
6564
| release | `string` | optional | Unique identifier for the release. This value can also be specified via the `SENTRY_RELEASE` environment variable. Defaults to the output of the `sentry-cli releases propose-version` command, which automatically detects values for Cordova, Heroku, AWS CodeBuild, CircleCI, Xcode, and Gradle, and otherwise uses the git `HEAD`'s commit SHA. (**the latter requires access to `git` CLI and for the root directory to be a valid repository**). |
6665
| dist | `string` | optional | Unique identifier for the distribution, used to further segment your release. Usually your build number. |

0 commit comments

Comments
 (0)