diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/transactions.test.ts index 6c99733381b6..3e146433defc 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/transactions.test.ts @@ -130,11 +130,11 @@ test('Should send a transaction for instrumented server actions', async ({ page await page.getByText('Run Action').click(); expect(await serverComponentTransactionPromise).toBeDefined(); - expect( - (await serverComponentTransactionPromise).contexts?.trace?.data?.['server_action_form_data.some-text-value'], - ).toEqual('some-default-value'); - expect((await serverComponentTransactionPromise).contexts?.trace?.data?.['server_action_result']).toEqual({ - city: 'Vienna', + expect((await serverComponentTransactionPromise).extra).toMatchObject({ + 'server_action_form_data.some-text-value': 'some-default-value', + server_action_result: { + city: 'Vienna', + }, }); expect(Object.keys((await serverComponentTransactionPromise).request?.headers || {}).length).toBeGreaterThan(0); diff --git a/packages/nextjs/src/common/withServerActionInstrumentation.ts b/packages/nextjs/src/common/withServerActionInstrumentation.ts index 2de1497b2dfd..1f4cdaf992c9 100644 --- a/packages/nextjs/src/common/withServerActionInstrumentation.ts +++ b/packages/nextjs/src/common/withServerActionInstrumentation.ts @@ -1,3 +1,4 @@ +import { getIsolationScope } from '@sentry/core'; import { addTracingExtensions, captureException, @@ -115,12 +116,12 @@ async function withServerActionInstrumentationImplementation { - isolationScope.setExtra( + getIsolationScope().setExtra( `server_action_form_data.${key}`, typeof value === 'string' ? value : '[non-string value]', );