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

[node][8.0.0] TypeError: acs.getCurrentScope is not a function #12054

Closed
3 tasks done
lcsvcn opened this issue May 15, 2024 · 7 comments · Fixed by #12206
Closed
3 tasks done

[node][8.0.0] TypeError: acs.getCurrentScope is not a function #12054

lcsvcn opened this issue May 15, 2024 · 7 comments · Fixed by #12206

Comments

@lcsvcn
Copy link

lcsvcn commented May 15, 2024

Is there an existing issue for this?

How do you use Sentry?

Sentry Self Hosted

Which SDK are you using?

@sentry/node

SDK Version

8.0.0

Framework Version

"@sentry/node": "^8.0.0",

Link to Sentry event

no link, setup issue.

SDK Setup

    Sentry.init({
      dsn: process.env.SENTRY_DSN,
      environment: process.env.SERVER_ENV,
      tracesSampleRate: 0,
      release: "1.0.0",
    })

Steps to Reproduce

  1. Update to 8.0.0
  2. Try to run

Expected Result

Application start normal

Actual Result

Failed to start server
TypeError: acs.getCurrentScope is not a function
    at getCurrentScope (/Users/lcsvcn/Documents/GitHub/backend-audio/node_modules/.pnpm/@[email protected]/node_modules/@sentry/src/currentScopes.ts:24:14)
    at Object.getClient (/Users/lcsvcn/Documents/GitHub/backend-audio/node_modules/.pnpm/@[email protected]/node_modules/@sentry/src/currentScopes.ts:131:10)
    at Object.hasTracingEnabled (/Users/lcsvcn/Documents/GitHub/backend-audio/node_modules/.pnpm/@[email protected]/node_modules/@sentry/src/utils/hasTracingEnabled.ts:19:18)
    at getDefaultIntegrations (/Users/lcsvcn/Documents/GitHub/backend-audio/node_modules/.pnpm/@[email protected]/node_modules/@sentry/src/sdk/init.ts:81:9)
    at getClientOptions (/Users/lcsvcn/Documents/GitHub/backend-audio/node_modules/.pnpm/@[email protected]/node_modules/@sentry/src/sdk/init.ts:219:35)
    at Object.init (/Users/lcsvcn/Documents/GitHub/backend-audio/node_modules/.pnpm/@[email protected]/node_modules/@sentry/src/sdk/init.ts:91:25)
    at main (/Users/lcsvcn/Documents/GitHub/backend-audio/src/server/
server.ts:38:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Screenshot 2024-05-15 at 12 10 01
@lcsvcn
Copy link
Author

lcsvcn commented May 15, 2024

Started after Dependabot changed from:

7.114.0 to 8.0.0

reverting to 7.114.0 works fine

@lcsvcn lcsvcn changed the title TypeError: acs.getCurrentScope is not a function [node][8.0.0] TypeError: acs.getCurrentScope is not a function May 15, 2024
@mydea
Copy link
Member

mydea commented May 16, 2024

Hey, thank you for reporting.

Some questions:

  1. What node version are you using?
  2. Could you share more of your init code, e.g. where in your app do you initialize Sentry?

I will look into this, it seems to me there may be some conflict there. One thing you could try is to log this before calling Sentry.init():

console.log(globalThis.__SENTRY__);

Does this output something for you? 🤔

mydea added a commit that referenced this issue May 16, 2024
…ble (#12066)

This is a bit weird in that we access the current scope & client etc.,
even if options are passed. Since we also use this method in `init()`
before we have setup stuff, it seems safer to avoid calling this at all
if possible.

This is related to
#12054, but not
really the cause of it.
@Mintoo200
Copy link

Same issue here, migrating from configureScope() to getCurrentScope(). Adding console.log(globalThis.__SENTRY__); outputs nothing both in sentry.client.config.ts and sentry.server.config.ts.
Currently running node v20.12.0 and our config files can be found here for the client and for the server

@Lms24
Copy link
Member

Lms24 commented May 23, 2024

@Mintoo200 just to rule one thing out: Did you follow the migration guide for initializing the v8 SDK? I looked at your repo and couldn't find the instrumentation.js file that you need for NextJS with v8.

@mydea
Copy link
Member

mydea commented May 23, 2024

Looking into this some more, in addition to @Lms24 comment above, I think @Mintoo200 your problem is because of https://www.npmjs.com/package/pino-sentry, which uses v7 of the SDK, see https://github.com/aandrewww/pino-sentry/blob/master/package.json#L37. This has to be updated to be compatible with v8!

I opened an issue for this: aandrewww/pino-sentry#68

@Mintoo200
Copy link

Mintoo200 commented May 23, 2024

Did you follow the migration guide for initializing the v8 SDK?

Indeed we did not, we relied on the changelog, which didn't mention it. I'll take a peek today, thanks for the pointer :)

I opened an issue for this: aandrewww/pino-sentry#68

Thanks !

@mydea
Copy link
Member

mydea commented May 23, 2024

@lcsvcn also for your original issue, I think the most likely cause is that there is somehow an older version of Sentry installed & used as well - could that be the case?

FWIW we are looking into ways to make this less likely to break, but in any case such a setup would always be subject to have problems, so this should be resolved in any case - there should always just be a single version of Sentry installed and run in your app!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants