Skip to content

Commit 3e6d0dd

Browse files
authored
fix(astro): Do not show warnings for valid options (#18947)
closes #18946 closes [JS-1536](https://linear.app/getsentry/issue/JS-1536/contradicting-warnings-between-sentryastro-and-sentry-vite-plugin) This is a follow up PR for #17396 I also changed the name to `doNotUseTheseOptions` to kinda prevent this in the future
1 parent d90c116 commit 3e6d0dd

2 files changed

Lines changed: 23 additions & 14 deletions

File tree

packages/astro/src/integration/index.ts

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,21 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => {
3535
bundleSizeOptimizations,
3636
unstable_sentryVitePluginOptions,
3737
debug,
38-
...otherOptions
38+
org,
39+
project,
40+
authToken,
41+
sentryUrl,
42+
headers,
43+
telemetry,
44+
silent,
45+
errorHandler,
46+
...deprecatedOptions
3947
} = options;
4048

41-
const otherOptionsKeys = Object.keys(otherOptions);
42-
if (otherOptionsKeys.length > 0) {
49+
const deprecatedOptionsKeys = Object.keys(deprecatedOptions);
50+
if (deprecatedOptionsKeys.length > 0) {
4351
logger.warn(
44-
`You passed in additional options (${otherOptionsKeys.join(
52+
`You passed in additional options (${deprecatedOptionsKeys.join(
4553
', ',
4654
)}) to the Sentry integration. This is deprecated and will stop working in a future version. Instead, configure the Sentry SDK in your \`sentry.client.config.(js|ts)\` or \`sentry.server.config.(js|ts)\` files.`,
4755
);
@@ -101,26 +109,26 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => {
101109
sentryVitePlugin({
102110
// Priority: top-level options > deprecated options > env vars
103111
// eslint-disable-next-line deprecation/deprecation
104-
org: options.org ?? uploadOptions.org ?? env.SENTRY_ORG,
112+
org: org ?? uploadOptions.org ?? env.SENTRY_ORG,
105113
// eslint-disable-next-line deprecation/deprecation
106-
project: options.project ?? uploadOptions.project ?? env.SENTRY_PROJECT,
114+
project: project ?? uploadOptions.project ?? env.SENTRY_PROJECT,
107115
// eslint-disable-next-line deprecation/deprecation
108-
authToken: options.authToken ?? uploadOptions.authToken ?? env.SENTRY_AUTH_TOKEN,
109-
url: options.sentryUrl ?? env.SENTRY_URL,
110-
headers: options.headers,
116+
authToken: authToken ?? uploadOptions.authToken ?? env.SENTRY_AUTH_TOKEN,
117+
url: sentryUrl ?? env.SENTRY_URL,
118+
headers,
111119
// eslint-disable-next-line deprecation/deprecation
112-
telemetry: options.telemetry ?? uploadOptions.telemetry ?? true,
113-
silent: options.silent ?? false,
114-
errorHandler: options.errorHandler,
120+
telemetry: telemetry ?? uploadOptions.telemetry ?? true,
121+
silent: silent ?? false,
122+
errorHandler,
115123
_metaOptions: {
116124
telemetry: {
117125
metaFramework: 'astro',
118126
},
119127
},
120128
...unstableMerged_sentryVitePluginOptions,
121-
debug: options.debug ?? false,
129+
debug: debug ?? false,
122130
sourcemaps: {
123-
...options.sourcemaps,
131+
...sourcemaps,
124132
// eslint-disable-next-line deprecation/deprecation
125133
assets: sourcemaps?.assets ?? uploadOptions.assets ?? [getSourcemapsAssetsGlob(config)],
126134
filesToDeleteAfterUpload:

packages/astro/test/integration/index.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ describe('sentryAstro integration', () => {
352352

353353
it('injects runtime config into client and server init scripts and warns about deprecation', async () => {
354354
const integration = sentryAstro({
355+
project: 'my-project',
355356
environment: 'test',
356357
release: '1.0.0',
357358
dsn: 'https://test.sentry.io/123',

0 commit comments

Comments
 (0)