diff --git a/docs/migration/v8-to-v9.md b/docs/migration/v8-to-v9.md index ba1208a4b6a4..e1a3d83615c1 100644 --- a/docs/migration/v8-to-v9.md +++ b/docs/migration/v8-to-v9.md @@ -116,6 +116,11 @@ Older Typescript versions _may_ still work, but we will not test them anymore an - By default, source maps will now be automatically deleted after being uploaded to Sentry for client-side builds. You can opt out of this behavior by explicitly setting `sourcemaps.deleteSourcemapsAfterUpload` to `false` in your Sentry config. +### `@sentry/sveltekit` + +- SvelteKit 1 is no longer supported, due to some features missing in the first version of the framework. This allows the SDK to remove some brittle workarounds that were necessary for proper 1.x support. +- In v8, the Sentry SvelteKit SDK would inject a small `` : ''; - - const modifiedHead = `${headWithMetaTags}${headWithFetchScript}`; - - return html.replace('', modifiedHead); - }; -} +export const addSentryCodeToPage = (({ html }) => { + const metaTags = getTraceMetaTags(); + const headWithMetaTags = metaTags ? `\n${metaTags}` : ''; + return html.replace('', headWithMetaTags); +}) satisfies NonNullable; /** * A SvelteKit handle function that wraps the request for Sentry error and @@ -108,7 +68,6 @@ export function addSentryCodeToPage(options: SentryHandleOptions): NonNullable 'xx'); @@ -429,46 +429,21 @@ describe('addSentryCodeToPage', () => { `; - it("Adds add meta tags and fetch proxy script if there's no active transaction", () => { - const transformPageChunk = addSentryCodeToPage({}); - const transformed = transformPageChunk({ html, done: true }); + it("Adds add meta tags if there's no active transaction", () => { + const transformed = addSentryCodeToPage({ html, done: true }); expect(transformed).toContain(' { - const transformPageChunk = addSentryCodeToPage({}); + it('adds meta tags if there is an active transaction', () => { SentryNode.startSpan({ name: 'test' }, () => { - const transformed = transformPageChunk({ html, done: true }) as string; + const transformed = addSentryCodeToPage({ html, done: true }); expect(transformed).toContain('${FETCH_PROXY_SCRIPT}`); }); }); - - it('adds a nonce attribute to the script if the `fetchProxyScriptNonce` option is specified', () => { - const transformPageChunk = addSentryCodeToPage({ fetchProxyScriptNonce: '123abc' }); - SentryNode.startSpan({ name: 'test' }, () => { - const transformed = transformPageChunk({ html, done: true }) as string; - - expect(transformed).toContain('${FETCH_PROXY_SCRIPT}`); - }); - }); - - it('does not add the fetch proxy script if the `injectFetchProxyScript` option is false', () => { - const transformPageChunk = addSentryCodeToPage({ injectFetchProxyScript: false }); - const transformed = transformPageChunk({ html, done: true }) as string; - - expect(transformed).toContain('${FETCH_PROXY_SCRIPT}`); - }); });