From aa4cb1b071a354e54c900aae5bfd40fed3185d20 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Mon, 27 Nov 2023 18:03:38 +0100 Subject: [PATCH 1/2] feat(astro): Document assets sourcemaps upload option --- .../sourcemaps/overview/javascript.astro.mdx | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/src/platform-includes/sourcemaps/overview/javascript.astro.mdx b/src/platform-includes/sourcemaps/overview/javascript.astro.mdx index 780faa38be0fc6..c71d3f8f40221d 100644 --- a/src/platform-includes/sourcemaps/overview/javascript.astro.mdx +++ b/src/platform-includes/sourcemaps/overview/javascript.astro.mdx @@ -28,9 +28,9 @@ export default defineConfig({ }); ``` -### Working With Old Authentication Tokens +### Disable Source Maps Upload -Source maps work best with [organization-scoped auth tokens](/product/accounts/auth-tokens/#organization-auth-tokens). If you are using an old self-hosted Sentry version that doesn't yet support org-based tokens or you're using a different type of Sentry auth token, you'll need to additionally specify your `org` slug in your `sourceMapsUploadOptions`: +You can disable automatic source maps upload in your Astro config: ```javascript {filename:astro.config.mjs} export default defineConfig({ @@ -38,18 +38,35 @@ export default defineConfig({ sentry({ // Other Sentry options sourceMapsUploadOptions: { - project: "___PROJECT_SLUG___", - org: "___ORG_SLUG___", - authToken: process.env.SENTRY_AUTH_TOKEN, + enabled: false, }, }), ], }); ``` -### Disable Source Maps Upload +### Setting Source Maps Assets directory -You can disable automatic source maps upload in your Astro config: +By default, the Sentry Astro integration will look for source maps in sensible default directories, depending on your `outDir`, `rootDir` and `adapter` configuration. +If these defaults don't work for you (e.g. due to an advanced customized build setup or an unsupported adapter), you can specify the `assets` option to point to the folder(s) where your source maps are located: + +```javascript {filename:astro.config.mjs} +export default defineConfig({ + integrations: [ + sentry({ + sourceMapsUploadOptions: { + assets: [".clientOut/**/*", ".serverOut/**/*"], + }, + }), + ], +}); +``` + +The specified patterns must follow the [glob syntax](https://www.npmjs.com/package/glob#glob-primer). + +### Working With Old Authentication Tokens + +Source maps work best with [organization-scoped auth tokens](/product/accounts/auth-tokens/#organization-auth-tokens). If you are using an old self-hosted Sentry version that doesn't yet support org-based tokens or you're using a different type of Sentry auth token, you'll need to additionally specify your `org` slug in your `sourceMapsUploadOptions`: ```javascript {filename:astro.config.mjs} export default defineConfig({ @@ -57,7 +74,9 @@ export default defineConfig({ sentry({ // Other Sentry options sourceMapsUploadOptions: { - enabled: false, + project: "___PROJECT_SLUG___", + org: "___ORG_SLUG___", + authToken: process.env.SENTRY_AUTH_TOKEN, }, }), ], From cb7efc79ea444f9edea29326172f56628e8b7e9d Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Wed, 29 Nov 2023 11:19:05 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Shana Matthews --- .../sourcemaps/overview/javascript.astro.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platform-includes/sourcemaps/overview/javascript.astro.mdx b/src/platform-includes/sourcemaps/overview/javascript.astro.mdx index c71d3f8f40221d..d7651d3e2b7b6f 100644 --- a/src/platform-includes/sourcemaps/overview/javascript.astro.mdx +++ b/src/platform-includes/sourcemaps/overview/javascript.astro.mdx @@ -45,10 +45,10 @@ export default defineConfig({ }); ``` -### Setting Source Maps Assets directory +### Setting the Source Maps Assets Directory By default, the Sentry Astro integration will look for source maps in sensible default directories, depending on your `outDir`, `rootDir` and `adapter` configuration. -If these defaults don't work for you (e.g. due to an advanced customized build setup or an unsupported adapter), you can specify the `assets` option to point to the folder(s) where your source maps are located: +If these defaults don't work for you (for example, due to an advanced customized build setup or an unsupported adapter), you can specify the `assets` option to point to the folder(s) where your source maps are located: ```javascript {filename:astro.config.mjs} export default defineConfig({