Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module @opentelemetry/instrumentation/hook.mjs after upgrade to v8 #12114

Closed
3 tasks done
felixgabler opened this issue May 18, 2024 · 5 comments · Fixed by #12135
Closed
3 tasks done

Cannot find module @opentelemetry/instrumentation/hook.mjs after upgrade to v8 #12114

felixgabler opened this issue May 18, 2024 · 5 comments · Fixed by #12135
Labels
Package: vue Issues related to the Sentry Vue SDK Type: Bug

Comments

@felixgabler
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/vue

SDK Version

8.2.1

Framework Version

Vue 3.4.27 (Nuxt 3.11.2)

Link to Sentry event

No response

SDK Setup

Sentry.init({
    enabled: !import.meta.dev,
    environment: import.meta.env.MODE,
    app: vueApp,
    dsn: sentryDsn,
    integrations: [
        new SupabaseIntegration(SupabaseClient, {
            tracing: true,
            breadcrumbs: true,
            errors: true,
        }),
        Sentry.browserTracingIntegration({
            router,
            shouldCreateSpanForRequest: (url) => !url.startsWith(`${supabaseUrl}/rest`),
        }),
        Sentry.captureConsoleIntegration({ levels: ['warn', 'error'] }),
    ],
    tracesSampleRate: 1.0,
    tracePropagationTargets: [/^\/(?!\/)/, supabaseUrl],
    ignoreErrors: ['AuthApiError: Invalid login credentials', 'FrontendError: errors.frontend.signInFailed'],
})

Steps to Reproduce

  1. Updated @sentry/vue and @sentry/node from 7.116.0 to 8.2.1
  2. Deployed to Vercel
  3. Got 500 error on both SSR and non-SSR routes

Expected Result

It should not break the deployment and import everything correctly in the build.

Actual Result

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/var/task/node_modules/@opentelemetry/instrumentation/hook.mjs' imported from /var/task/node_modules/@sentry/node/esm/sdk/init.js
at finalizeResolution (node:internal/modules/esm/resolve:269:11)
at moduleResolve (node:internal/modules/esm/resolve:937:10)
at moduleResolveWithNodePath (node:internal/modules/esm/resolve:1161:14)
at defaultResolve (node:internal/modules/esm/resolve:1204:79)
at nextResolve (node:internal/modules/esm/hooks:866:28)
at Hooks.resolve (node:internal/modules/esm/hooks:304:30)
at ModuleLoader.resolve (node:internal/modules/esm/loader:352:35)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:234:38)
at ModuleLoader.import (node:internal/modules/esm/loader:322:34)
at Hooks.register (node:internal/modules/esm/hooks:165:51) {
code: 'ERR_MODULE_NOT_FOUND',
url: 'file:///var/task/node_modules/@opentelemetry/instrumentation/hook.mjs'
}
Node.js process exited with exit status: 1. The logs above can help with debugging the issue.
INIT_REPORT Init Duration: 1620.35 ms	Phase: invoke	Status: error	Error Type: Runtime.ExitError

Not sure where the @sentry/node usage comes from since it is only used in a Nitro route that is not called during SSR. But perhaps the entire build is just broken.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 May 18, 2024
@github-actions github-actions bot added the Package: vue Issues related to the Sentry Vue SDK label May 18, 2024
@daniluk4000
Copy link

I've managed to fix this but it still doesn't work with another error I don't know how to fix

[nuxt] [request error] [unhandled] [500] ENOENT: no such file or directory, open '/frontend/.output/server/node_modules/vue/server-renderer/@vue/server-renderer'

@ThatGuySam
Copy link

Same issue when I upgraded to @sentry/astro v8 from my SSR Astro site on Netlify Functions

No build errors, no type errors, just fails render at runtime.

Tried 8.2.1, 8.2.0, 8.1.0

Only worked when I downgraded to 7.116.0

May 20, 11:06:20 AM: 60c44bc0 ERROR  16:06:24 [ERROR] Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/var/task/node_modules/@opentelemetry/instrumentation/hook.mjs' imported from /var/task/node_modules/@sentry/astro/node_modules/@sentry/node/esm/sdk/init.js
May 20, 11:06:20 AM: 60c44bc0 ERROR      at finalizeResolution (node:internal/modules/esm/resolve:269:11)
May 20, 11:06:20 AM: 60c44bc0 ERROR      at moduleResolve (node:internal/modules/esm/resolve:937:10)
May 20, 11:06:20 AM: 60c44bc0 ERROR      at moduleResolveWithNodePath (node:internal/modules/esm/resolve:1161:14)
May 20, 11:06:20 AM: 60c44bc0 ERROR      at defaultResolve (node:internal/modules/esm/resolve:1204:79)
May 20, 11:06:20 AM: 60c44bc0 ERROR      at nextResolve (node:internal/modules/esm/hooks:866:28)
May 20, 11:06:20 AM: 60c44bc0 ERROR      at Hooks.resolve (node:internal/modules/esm/hooks:304:30)
May 20, 11:06:20 AM: 60c44bc0 ERROR      at ModuleLoader.resolve (node:internal/modules/esm/loader:352:35)
May 20, 11:06:20 AM: 60c44bc0 ERROR      at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:234:38)
May 20, 11:06:20 AM: 60c44bc0 ERROR      at ModuleLoader.import (node:internal/modules/esm/loader:322:34)
May 20, 11:06:20 AM: 60c44bc0 ERROR      at Hooks.register (node:internal/modules/esm/hooks:165:51)

@mydea
Copy link
Member

mydea commented May 21, 2024

hmm, this is weird - this should not happen, and we have some tests for this. One thing we can try is add some additional safeguards around this code to try to prevent it from failing - I'll do that, hopefully this helps!

@daniluk4000
Copy link

Not sure it will fix since I also had issues with vue server renderer but we'll see

@ThatGuySam
Copy link

Installed 8.7.0 today and everything seems to work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: vue Issues related to the Sentry Vue SDK Type: Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants