Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 22 additions & 14 deletions packages/astro/src/integration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,21 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => {
bundleSizeOptimizations,
unstable_sentryVitePluginOptions,
debug,
...otherOptions
org,
project,
authToken,
sentryUrl,
headers,
telemetry,
silent,
errorHandler,
...deprecatedOptions
} = options;

const otherOptionsKeys = Object.keys(otherOptions);
if (otherOptionsKeys.length > 0) {
const deprecatedOptionsKeys = Object.keys(deprecatedOptions);
if (deprecatedOptionsKeys.length > 0) {
logger.warn(
`You passed in additional options (${otherOptionsKeys.join(
`You passed in additional options (${deprecatedOptionsKeys.join(
', ',
)}) 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.`,
);
Expand Down Expand Up @@ -101,26 +109,26 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => {
sentryVitePlugin({
// Priority: top-level options > deprecated options > env vars
// eslint-disable-next-line deprecation/deprecation
org: options.org ?? uploadOptions.org ?? env.SENTRY_ORG,
org: org ?? uploadOptions.org ?? env.SENTRY_ORG,
// eslint-disable-next-line deprecation/deprecation
project: options.project ?? uploadOptions.project ?? env.SENTRY_PROJECT,
project: project ?? uploadOptions.project ?? env.SENTRY_PROJECT,
// eslint-disable-next-line deprecation/deprecation
authToken: options.authToken ?? uploadOptions.authToken ?? env.SENTRY_AUTH_TOKEN,
url: options.sentryUrl ?? env.SENTRY_URL,
headers: options.headers,
authToken: authToken ?? uploadOptions.authToken ?? env.SENTRY_AUTH_TOKEN,
url: sentryUrl ?? env.SENTRY_URL,
headers,
// eslint-disable-next-line deprecation/deprecation
telemetry: options.telemetry ?? uploadOptions.telemetry ?? true,
silent: options.silent ?? false,
errorHandler: options.errorHandler,
telemetry: telemetry ?? uploadOptions.telemetry ?? true,
silent: silent ?? false,
errorHandler,
_metaOptions: {
telemetry: {
metaFramework: 'astro',
},
},
...unstableMerged_sentryVitePluginOptions,
debug: options.debug ?? false,
debug: debug ?? false,
sourcemaps: {
...options.sourcemaps,
...sourcemaps,
// eslint-disable-next-line deprecation/deprecation
assets: sourcemaps?.assets ?? uploadOptions.assets ?? [getSourcemapsAssetsGlob(config)],
filesToDeleteAfterUpload:
Expand Down
1 change: 1 addition & 0 deletions packages/astro/test/integration/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ describe('sentryAstro integration', () => {

it('injects runtime config into client and server init scripts and warns about deprecation', async () => {
const integration = sentryAstro({
project: 'my-project',
environment: 'test',
release: '1.0.0',
dsn: 'https://test.sentry.io/123',
Expand Down
Loading