File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -833,6 +833,24 @@ The following is an example of how to initialize the serverside SDK in a Next.js
833833 }
834834 ```
835835
836+ If you need to import a Node.js specific integration (like for example ` @sentry/profiling-node ` ), you will have to
837+ import the package using a dynamic import to prevent Next.js from bundling Node.js APIs into bundles for other
838+ runtime environments (like the Browser or the Edge runtime). You can do so as follows:
839+
840+ ``` ts
841+ import * as Sentry from ' @sentry/nextjs' ;
842+
843+ export async function register() {
844+ if (process .env .NEXT_RUNTIME === ' nodejs' ) {
845+ const { nodeProfilingIntegration } = await import (' @sentry/profiling-node' );
846+ Sentry .init ({
847+ dsn: ' YOUR_DSN' ,
848+ integrations: [nodeProfilingIntegration ()],
849+ });
850+ }
851+ }
852+ ```
853+
836854 Note that you can initialize the SDK differently depending on which server runtime is being used.
837855
838856If you are using a
You can’t perform that action at this time.
0 commit comments