Code Monkey home page Code Monkey logo

Comments (8)

lforst avatar lforst commented on June 4, 2024 1

It should be fine to inti the edge SDK with a dynamic import. If possible, try to leave the node SDK init synchronous.

from sentry-javascript.

lforst avatar lforst commented on June 4, 2024 1

This is actually a good insight. Thanks for raising this! I see this as a documentation issue we need to resolve.

from sentry-javascript.

r34son avatar r34son commented on June 4, 2024

Problem with @sentry/profiling-node integration

from sentry-javascript.

JonasBa avatar JonasBa commented on June 4, 2024

@r34son profiling will not work without a nodejs API, so I would recommend you remove this for edge runtime. I will need to look at how and if it's even possible to support this. I'm sorry if this isnt of much help.

from sentry-javascript.

r34son avatar r34son commented on June 4, 2024

@r34son profiling will not work without a nodejs API, so I would recommend you remove this for edge runtime. I will need to look at how and if it's even possible to support this. I'm sorry if this isnt of much help.

It is actually the problem, because of one chunk emited for both runtimes

from sentry-javascript.

r34son avatar r34son commented on June 4, 2024

Thanks!

from sentry-javascript.

r34son avatar r34son commented on June 4, 2024

If I init sdk this way:

import { init } from '@sentry/nextjs';
import { nodeProfilingIntegration } from '@sentry/profiling-node';
import { SENTRY_CAPTURE_RATE, SENTRY_DSN } from 'sentry.constants.mjs';

export async function register() {
  if (process.env.NEXT_RUNTIME === 'nodejs') {
    init({
      dsn: SENTRY_DSN,
      debug: false,
      tracesSampleRate: SENTRY_CAPTURE_RATE,
      profilesSampleRate: SENTRY_CAPTURE_RATE,
      environment: process.env.ENV,
      integrations: [nodeProfilingIntegration()],
    });
  }
  if (process.env.NEXT_RUNTIME === 'edge') {
    await import('./instrumentation.edge');
  }
}

It somehow fails in turbopack:
image

from sentry-javascript.

r34son avatar r34son commented on June 4, 2024

Only works importing @sentry/profiling-node dynamically:

import { init } from '@sentry/nextjs';
import { SENTRY_CAPTURE_RATE, SENTRY_DSN } from 'sentry.constants.mjs';

export async function register() {
  if (process.env.NEXT_RUNTIME === 'nodejs') {
    const { nodeProfilingIntegration } = await import('@sentry/profiling-node');
    init({
      dsn: SENTRY_DSN,
      debug: false,
      tracesSampleRate: SENTRY_CAPTURE_RATE,
      profilesSampleRate: SENTRY_CAPTURE_RATE,
      environment: process.env.ENV,
      integrations: [nodeProfilingIntegration()],
    });
  }
  if (process.env.NEXT_RUNTIME === 'edge') {
    await import('./instrumentation.edge');
  }
}

from sentry-javascript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.