sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

NextJS - Error not propagated when coming from server

Open nic-lan opened this issue 2 years ago • 18 comments

Environment

SaaS (https://sentry.io/)

What are you trying to accomplish?

I would like to be able to receive the errors on sentry.io to do a proper error monitoring of my app.

How are you getting stuck?

Description

I believe that Sentry is well configured, but errors coming from the server ( edge and node next runtimes ) does not get propagated to the project issues page in the Sentry.io.

The issue is not present in the client.

nextConfigWithSentry Config

{
  org: 'my-org',
  silent: true,
  widenClientFileUpload: true,
  hideSourceMaps: true,
  disableLogger: false,
  automaticVercelMonitors: false,
  autoInstrumentServerFunctions: true,
  authToken: ***,
  project: 'my-app'
}

Sentry Init Config

{
  enableTracing: false,
  dsn: 'the-project-dsn',
  release: 'sentry-not-sending-errors',
  environment: 'development',
  debug: true
}

Where in the product are you?

Issues

Link

No response

DSN

No response

Version

No response

nic-lan avatar Jul 08 '24 11:07 nic-lan

Auto-routing to @getsentry/product-owners-issues for triage ⏲️

getsantry[bot] avatar Jul 08 '24 11:07 getsantry[bot]

Here some additional infos about the issue.

I intentionally raise an error in one of the app routes and manually send it to Sentry to ensure that the process is happening.

export async function GET() {
  const logger = getLogger()

  try {
    throw new Error("Ups on GET /my/routes")
  }
  catch (error) {
    logger.error(error)
    Sentry.captureException(error)
  }
  ...
}

Starting up the app with yarn dev I can see the following sentry debug logs:

  ▲ Next.js 14.2.4
  - Local:        http://localhost:3000
  - Environments: .env.local
  - Experiments (use with caution):
    · instrumentationHook

 ✓ Starting...
warn  - It seems like you don't have a global error handler set up. It is recommended that you add a global-error.js file with Sentry instrumentation so that React rendering errors are reported to Sentry. Read more: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#react-render-errors-in-app-router (you can suppress this warning by setting SENTRY_SUPPRESS_GLOBAL_ERROR_HANDLER_FILE_WARNING=1 as environment variable)
 ○ Compiling /instrumentation ...
 ✓ Compiled /instrumentation in 1684ms (839 modules)
Sentry Logger [log]: Initializing SDK...
Sentry Logger [log]: Initializing Sentry: process: 82233, thread: main.
Sentry Logger [log]: Integration installed: InboundFilters
Sentry Logger [log]: Integration installed: FunctionToString
Sentry Logger [log]: Integration installed: LinkedErrors
Sentry Logger [log]: Integration installed: RequestData
Sentry Logger [log]: Integration installed: Console
Sentry Logger [log]: Integration installed: NodeFetch
Sentry Logger [log]: Integration installed: OnUncaughtException
Sentry Logger [log]: Integration installed: OnUnhandledRejection
Sentry Logger [log]: Integration installed: ContextLines
Sentry Logger [log]: Integration installed: LocalVariablesAsync
Sentry Logger [log]: Integration installed: Context
Sentry Logger [log]: Integration installed: Modules
Sentry Logger [log]: Integration installed: Http
Sentry Logger [log]: Integration installed: DistDirRewriteFrames
Sentry Logger [log]: Running in CommonJS mode.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for diag v1.9.0.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for trace v1.9.0.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for context v1.9.0.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for propagation v1.9.0.
Sentry Logger [log]: SDK successfully initialized
'INFO Ready in 4.6s'

When navigating to the route which raise the error I get

Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
==== HERE my error log ( omitted to avoid spamming ) ====
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
Sentry Logger [debug]: @opentelemetry/instrumentation-http http instrumentation outgoingRequest
Sentry Logger [debug]: @opentelemetry/instrumentation-http http.ClientRequest return request
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
Sentry Logger [debug]: @opentelemetry/instrumentation-http http instrumentation outgoingRequest
Sentry Logger [debug]: @opentelemetry/instrumentation-http http.ClientRequest return request
Sentry Logger [debug]: @opentelemetry/instrumentation-http outgoingRequest on response()
Sentry Logger [debug]: @opentelemetry/instrumentation-http outgoingRequest on end()
Sentry Logger [debug]: @opentelemetry/instrumentation-http outgoingRequest on request close()
Sentry Logger [debug]: @opentelemetry/instrumentation-http outgoingRequest on response()
Sentry Logger [debug]: @opentelemetry/instrumentation-http outgoingRequest on end()
Sentry Logger [debug]: @opentelemetry/instrumentation-http outgoingRequest on request close()
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span

nic-lan avatar Jul 08 '24 12:07 nic-lan

Hey @nic-lan thanks for reaching out. I could not reproduce this, could you possibly provide more information on your setup or in best case a repo? Please let me know which SDK and Next.js versions you are using. I assume you are throwing the error in an app/api/my/routes route?

chargome avatar Jul 10 '24 07:07 chargome

Hey @chargome,

Thank for coming back to me.

Package Versions:

  • nextJs: 14.2.4
  • @sentry/nextjs: '8.17.0'

So, yes, you assume correct. I throw the error in my api route.

\\ src/app/api/my/route.ts
export async function GET() {
  throw new Error('ups')
  ...
}

The Sentry it is initialised at src/instrumentation.ts as follow:

import * as Sentry from '@sentry/nextjs'

export async function register() {
  if (process.env.NEXT_RUNTIME == 'node') {
    Sentry.init({
      enableTracing: false,
      dsn: 'the-prject-dsn',
      release: 'nic-lan-sentry-not-sending-errors',
      environment: 'development',
      debug: true
    })
  }

  if (process.env.NEXT_RUNTIME == 'edge') {
    Sentry.init({
      enableTracing: false,
      dsn: 'the-prject-dsn',
      release: 'nic-lan-sentry-not-sending-errors',
      environment: 'development',
      debug: true
    })
  }
 }

in the next.config.js I set instrumentation hook to ensure the register function get performed

  experimental: {
    instrumentationHook: true
  }

At the same time I might have one finding. When I throw the error in the middleware, the middleware error gets propagated to the Sentry.io. So it seems that the sentry SDK is able to monitor the errors happening in the middleware but not in the api routes.

By checking tweaking the logger a bit I was able to print out the following error stack related with the error in the api route.

"Error: ups inside GET clients",
        "at GET$1 (webpack-internal:///(rsc)/./src/app/api/clients/route.ts:34:11)",
        "at eval (webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js:57:44)",
        "at Object.handleCallbackErrors (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/utils/handleCallbackErrors.js:26:26)",
        "at eval (webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js:56:47)",
        "at handleCallbackErrors.handleCallbackErrors.status.status (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js:63:15)",
        "at Object.handleCallbackErrors (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/utils/handleCallbackErrors.js:26:26)",
        "at eval (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js:62:35)",
        "at eval (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js:445:21)",
        "at eval (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js:46:12)",
        "at AsyncContextStack.withScope (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js:41:28)",
        "at Object.withScope (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js:127:33)",
        "at Object.withScope (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/currentScopes.js:55:18)",
        "at Object.startSpan (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js:42:24)",
        "at eval (webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js:45:27)",
        "at AsyncContextStack.withScope (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js:41:28)",
        "at Object.withScope (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js:127:33)",
        "at Object.withScope (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/currentScopes.js:61:14)",
        "at eval (webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js:41:23)",
        "at eval (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js:140:12)",
        "at AsyncContextStack.withScope (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js:41:28)",
        "at withIsolationScope (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js:139:33)",
        "at Object.withSetIsolationScope (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js:153:14)",
        "at Object.withIsolationScope (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/currentScopes.js:93:16)",
        "at eval (webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js:40:21)",
        "at eval (webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/utils/tracingUtils.js:85:16)",
        "at AsyncLocalStorage.run (node:async_hooks:346:14)",
        "at eval (webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/utils/tracingUtils.js:84:40)",
        "at eval (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js:220:12)",
        "at AsyncContextStack.withScope (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js:41:28)",
        "at Object.withScope (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js:127:33)",
        "at Object.withScope (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/currentScopes.js:61:14)",
        "at withActiveSpan (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js:218:24)",
        "at eval (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js:258:12)",
        "at AsyncContextStack.withScope (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js:41:28)",
        "at Object.withScope (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js:127:33)",
        "at Object.withScope (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/currentScopes.js:61:14)",
        "at Object.startNewTrace (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js:255:24)",
        "at Object.escapeNextjsTracing (webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/utils/tracingUtils.js:83:17)",
        "at Object.apply (webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js:22:27)",
        "at Object.apply (webpack-internal:///(rsc)/./src/app/api/clients/route.ts:72:10)",
        "at ./node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:55044",
        "at ./node_modules/next/dist/server/lib/trace/tracer.js:140:36",
        "at NoopContextManager.with (./node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js:25:19)",
        "at ContextAPI.with (./node_modules/@opentelemetry/api/build/src/api/context.js:60:46)",
        "at NoopTracer.startActiveSpan (./node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js:65:31)",
        "at ProxyTracer.startActiveSpan (./node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js:36:24)",
        "at ./node_modules/next/dist/server/lib/trace/tracer.js:122:103",
        "at NoopContextManager.with (./node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js:25:19)",
        "at ContextAPI.with (./node_modules/@opentelemetry/api/build/src/api/context.js:60:46)",
        "at NextTracerImpl.trace (./node_modules/next/dist/server/lib/trace/tracer.js:122:28)

nic-lan avatar Jul 10 '24 13:07 nic-lan

Hi, I also cannot reproduce this issue. Would you mind sharing a minimal reproduction example so we can confirm this locally? Thanks!

lforst avatar Jul 10 '24 13:07 lforst

Hi @nic-lan, Are you by any chance using pageExtensions in next.config.js? We are facing a similar issue and we found out it is because of this attribute in the next config.

ziyadkhalil avatar Jul 10 '24 23:07 ziyadkhalil

Hi @ziyadkhalil,

the next.config.js is

const nextConfig = {
  reactStrictMode: false,
  compiler: {
    styledComponents: true
  },
  output: 'standalone',
  basePath: '/portal',
  experimental: {
    instrumentationHook: true
  },
  async redirects() {
    return [
      {
        source: '/:company/admin',
        destination: '/:company/admin/clients',
        permanent: true
      }
    ]
  }
}

nic-lan avatar Jul 11 '24 08:07 nic-lan

@nic-lan it would be best if you could share a reproduction example we can locally try. Thanks!

lforst avatar Jul 11 '24 08:07 lforst

@lforst I am working on that.

nic-lan avatar Jul 11 '24 08:07 nic-lan

I was able to create a minimal example repo where I can replicate the issue locally:

https://github.com/nic-lan/sentry-not-working-example

nic-lan avatar Jul 11 '24 10:07 nic-lan

Seems like you have a typo because you are doing process.env.NEXT_RUNTIME == "node" instead of process.env.NEXT_RUNTIME == "nodejs"

lforst avatar Jul 11 '24 10:07 lforst

ohhh yeah. that was clearly wrong. apologies for it 🙏

I have updated the repo and re-run with yarn dev.

The previous issue went away and I think that we are now getting closer to why the error does not get propagated. I have update the docs in the repo example, but I will post here them too, so that you can have a check:

 ✓ Compiled /src/middleware in 185ms (274 modules)
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
Sentry Logger [debug]: @opentelemetry/instrumentation-http Applying instrumentation patch for nodejs core module on require hook { module: 'http' }
Sentry Logger [log]: Integration installed: InboundFilters
Sentry Logger [log]: Integration installed: FunctionToString
Sentry Logger [log]: Integration installed: LinkedErrors
Sentry Logger [log]: Integration installed: WinterCGFetch
Sentry Logger [log]: Integration installed: DistDirRewriteFrames
Received Request /api/clients
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
 ○ Compiling /api/clients ...
 ✓ Compiled /api/clients in 981ms (1407 modules)
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
Sentry Logger [debug]: @opentelemetry/instrumentation-http Applying instrumentation patch for nodejs core module on require hook { module: 'https' }
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
Sentry Logger [debug]: Recording is off, propagating context in a non-recording span
Sentry Logger [log]: SpanExporter exported 0 spans, 0 unsent spans remaining
 ⨯ Error: ups inside GET clients
    at GET$1 (webpack-internal:///(rsc)/./src/app/api/clients/route.ts:26:11)
    at eval (webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js:57:44)
    at Object.handleCallbackErrors (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/utils/handleCallbackErrors.js:26:26)
    at eval (webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js:56:47)
    at eval (webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js:853:15)
    at Object.handleCallbackErrors (webpack-internal:///(instrument)/./node_modules/@sentry/core/build/cjs/utils/handleCallbackErrors.js:26:26)
    at eval (webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js:852:19)
    at AsyncLocalStorage.run (node:async_hooks:346:14)
    at SentryContextManager.with (webpack-internal:///(instrument)/./node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js:33:40)
    at SentryContextManager.with (webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js:1306:24)
    at ContextAPI.with (webpack-internal:///(instrument)/./node_modules/@opentelemetry/api/build/esm/api/context.js:95:54)
    at Tracer.startActiveSpan (webpack-internal:///(instrument)/./node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js:136:76)
    at eval (webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js:849:19)
    at eval (webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js:1098:21)
    at Object.startSpan (webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js:842:10)
    at Object.startSpan (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js:36:16)
    at eval (webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js:45:27)
    at eval (webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js:1181:14)
    at AsyncLocalStorage.run (node:async_hooks:346:14)
    at SentryContextManager.with (webpack-internal:///(instrument)/./node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js:33:40)
    at SentryContextManager.with (webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js:1306:24)
    at ContextAPI.with (webpack-internal:///(instrument)/./node_modules/@opentelemetry/api/build/esm/api/context.js:95:54)
    at Object.withScope (webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js:1180:28)
    at Object.withScope (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/currentScopes.js:61:14)
    at eval (webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js:41:23)
    at eval (webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js:1216:14)
    at AsyncLocalStorage.run (node:async_hooks:346:14)
    at SentryContextManager.with (webpack-internal:///(instrument)/./node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js:33:40)
    at SentryContextManager.with (webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js:1306:24)
    at ContextAPI.with (webpack-internal:///(instrument)/./node_modules/@opentelemetry/api/build/esm/api/context.js:95:54)
    at Object.withSetIsolationScope (webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js:1215:28)
    at Object.withIsolationScope (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/currentScopes.js:93:16)
    at eval (webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js:40:21)
    at eval (webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/utils/tracingUtils.js:85:16)
    at AsyncLocalStorage.run (node:async_hooks:346:14)
    at eval (webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/utils/tracingUtils.js:84:40)
    at eval (webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js:953:59)
    at AsyncLocalStorage.run (node:async_hooks:346:14)
    at SentryContextManager.with (webpack-internal:///(instrument)/./node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js:33:40)
    at SentryContextManager.with (webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js:1306:24)
    at ContextAPI.with (webpack-internal:///(instrument)/./node_modules/@opentelemetry/api/build/esm/api/context.js:95:54)
    at Object.withActiveSpan (webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js:953:26)
    at withActiveSpan (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js:215:16)
    at eval (webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js:258:12)
    at eval (webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js:1181:14)
    at AsyncLocalStorage.run (node:async_hooks:346:14)
    at SentryContextManager.with (webpack-internal:///(instrument)/./node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js:33:40)
    at SentryContextManager.with (webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js:1306:24)
    at ContextAPI.with (webpack-internal:///(instrument)/./node_modules/@opentelemetry/api/build/esm/api/context.js:95:54)
    at Object.withScope (webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js:1180:28)
 GET /clients 500 in 1319ms
Sentry Logger [error]: Failed to read file: webpack-internal:///(rsc)/./src/app/api/clients/route.ts. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(rsc)/./src/app/api/clients/route.ts'
Sentry Logger [error]: Failed to read file: webpack-internal:///(rsc)/./src/app/api/clients/route.ts. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(rsc)/./src/app/api/clients/route.ts'
Sentry Logger [error]: Failed to read file: webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/utils/handleCallbackErrors.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/utils/handleCallbackErrors.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/utils/handleCallbackErrors.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/utils/handleCallbackErrors.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(instrument)/./node_modules/@sentry/core/build/cjs/utils/handleCallbackErrors.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(instrument)/./node_modules/@sentry/core/build/cjs/utils/handleCallbackErrors.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(instrument)/./node_modules/@sentry/core/build/cjs/utils/handleCallbackErrors.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(instrument)/./node_modules/@sentry/core/build/cjs/utils/handleCallbackErrors.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(instrument)/./node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(instrument)/./node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(instrument)/./node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(instrument)/./node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(instrument)/./node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(instrument)/./node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(instrument)/./node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(instrument)/./node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(instrument)/./node_modules/@opentelemetry/api/build/esm/api/context.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(instrument)/./node_modules/@opentelemetry/api/build/esm/api/context.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(instrument)/./node_modules/@opentelemetry/api/build/esm/api/context.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(instrument)/./node_modules/@opentelemetry/api/build/esm/api/context.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/currentScopes.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/currentScopes.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/currentScopes.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/currentScopes.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/utils/tracingUtils.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/utils/tracingUtils.js'
Sentry Logger [error]: Failed to read file: webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/utils/tracingUtils.js. Error: Error: ENOENT: no such file or directory, open 'webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/utils/tracingUtils.js'
Sentry Logger [error]: Could not find line 1173 in file webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js
Sentry Logger [error]: Could not find line 88 in file webpack-internal:///(instrument)/./node_modules/@opentelemetry/api/build/esm/api/context.js
Sentry Logger [error]: Could not find line 1299 in file webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js
Sentry Logger [error]: Could not find line 26 in file webpack-internal:///(instrument)/./node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js
Sentry Logger [error]: Could not find line 1174 in file webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js
Sentry Logger [error]: Could not find line 251 in file webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js
Sentry Logger [error]: Could not find line 208 in file webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js
Sentry Logger [error]: Could not find line 946 in file webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js
Sentry Logger [error]: Could not find line 88 in file webpack-internal:///(instrument)/./node_modules/@opentelemetry/api/build/esm/api/context.js
Sentry Logger [error]: Could not find line 1299 in file webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js
Sentry Logger [error]: Could not find line 26 in file webpack-internal:///(instrument)/./node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js
Sentry Logger [error]: Could not find line 946 in file webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js
Sentry Logger [error]: Could not find line 77 in file webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/utils/tracingUtils.js
Sentry Logger [error]: Could not find line 78 in file webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/utils/tracingUtils.js
Sentry Logger [error]: Could not find line 33 in file webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js
Sentry Logger [error]: Could not find line 86 in file webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/currentScopes.js
Sentry Logger [error]: Could not find line 1208 in file webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js
Sentry Logger [error]: Could not find line 88 in file webpack-internal:///(instrument)/./node_modules/@opentelemetry/api/build/esm/api/context.js
Sentry Logger [error]: Could not find line 1299 in file webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js
Sentry Logger [error]: Could not find line 26 in file webpack-internal:///(instrument)/./node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js
Sentry Logger [error]: Could not find line 1209 in file webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js
Sentry Logger [error]: Could not find line 34 in file webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js
Sentry Logger [error]: Could not find line 54 in file webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/currentScopes.js
Sentry Logger [error]: Could not find line 1173 in file webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js
Sentry Logger [error]: Could not find line 88 in file webpack-internal:///(instrument)/./node_modules/@opentelemetry/api/build/esm/api/context.js
Sentry Logger [error]: Could not find line 1299 in file webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js
Sentry Logger [error]: Could not find line 26 in file webpack-internal:///(instrument)/./node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js
Sentry Logger [error]: Could not find line 1174 in file webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js
Sentry Logger [error]: Could not find line 38 in file webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js
Sentry Logger [error]: Could not find line 29 in file webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/tracing/trace.js
Sentry Logger [error]: Could not find line 835 in file webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js
Sentry Logger [error]: Could not find line 1091 in file webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js
Sentry Logger [error]: Could not find line 842 in file webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js
Sentry Logger [error]: Could not find line 129 in file webpack-internal:///(instrument)/./node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js
Sentry Logger [error]: Could not find line 88 in file webpack-internal:///(instrument)/./node_modules/@opentelemetry/api/build/esm/api/context.js
Sentry Logger [error]: Could not find line 1299 in file webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js
Sentry Logger [error]: Could not find line 26 in file webpack-internal:///(instrument)/./node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js
Sentry Logger [error]: Could not find line 845 in file webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js
Sentry Logger [error]: Could not find line 19 in file webpack-internal:///(instrument)/./node_modules/@sentry/core/build/cjs/utils/handleCallbackErrors.js
Sentry Logger [error]: Could not find line 846 in file webpack-internal:///(instrument)/./node_modules/@sentry/opentelemetry/build/cjs/index.js
Sentry Logger [error]: Could not find line 49 in file webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js
Sentry Logger [error]: Could not find line 19 in file webpack-internal:///(rsc)/./node_modules/@sentry/core/build/cjs/utils/handleCallbackErrors.js
Sentry Logger [error]: Could not find line 50 in file webpack-internal:///(rsc)/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js
...

nic-lan avatar Jul 11 '24 11:07 nic-lan

For me, the error gets reported. You can ignore the logs. They show up because you have tracing disabled.

lforst avatar Jul 11 '24 11:07 lforst

Propagation means that tracing data is not passed downstream. It has nothing to do with errors not being reported.

lforst avatar Jul 11 '24 11:07 lforst

I don't understand.

I don't see the error in the Sentry io issues page of the project. This is what the issue is about. In my case the error is still "not being reported" in the issues page of the project.

Are you facing the same or not ?

nic-lan avatar Jul 11 '24 11:07 nic-lan

When I cloned your app, and fixed the typo, I successfully received the error in Sentry.

Screenshot 2024-07-11 at 13 34 38

Please check that you don't have any filters selected in Sentry that may not show the issue.

lforst avatar Jul 11 '24 11:07 lforst

Hi, there is no filtering activated in the company project settings. however I was behind a VPN. By disconnecting from it, the error was finally reported to the Sentry platform.

That been said, there are still some errors which don't get reported, but I am not able to replicate them locally. I think that I will re-open or come back here whenever I have some news on that. I wonder if adding a process.on could help me catching the missing ones:

process.on('uncaughtException', (error) => {
  Sentry.captureException(error);
});

In any case I thank you for the support and patience on this 🙏

nic-lan avatar Jul 15 '24 10:07 nic-lan

Sentry already attaches itself to uncaughtException.

I will close this issue since it seems to be resolved. If you run into unrelated problems, please open a new issue. Thank you!

lforst avatar Jul 15 '24 10:07 lforst