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

_scope.setSDKProcessingMetadata is not a function #6198

Closed
3 tasks done
BenGale opened this issue Nov 14, 2022 · 6 comments
Closed
3 tasks done

_scope.setSDKProcessingMetadata is not a function #6198

BenGale opened this issue Nov 14, 2022 · 6 comments

Comments

@BenGale
Copy link

BenGale commented Nov 14, 2022

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/node

SDK Version

7.19.0

Framework Version

No response

Link to Sentry event

No response

Steps to Reproduce

I've installed the latest @sentry/node package at version 7.19.0.
Followed the setup guides which don't seem to have changed since I was using the old version and this all works before.

Expected Result

The app not to explode.

Actual Result

The app explodes when a request is made with the following error:

TypeError: _scope.setSDKProcessingMetadata is not a function
    at /app/node_modules/@sentry/node/cjs/handlers.js:249:16
        -> /app/node_modules/@sentry/src/handlers.ts:280:1
    at Hub.withScope (/app/node_modules/@sentry/hub/dist/hub.js:85:13)
        -> /app/node_modules/@sentry/hub/src/hub.ts:154:7
    at Object.withScope (/app/node_modules/@sentry/core/cjs/exports.js:143:23)
        -> /app/node_modules/@sentry/src/exports.ts:157:1
    at sentryErrorMiddleware (/app/node_modules/@sentry/node/cjs/handlers.js:245:12)
        -> /app/node_modules/@sentry/src/handlers.ts:276:1
    at /app/node_modules/@sentry/tracing/cjs/integrations/node/express.js:122:12
        -> /app/node_modules/src/integrations/node/express.ts:191:1
    at Layer.handle_error (/app/node_modules/express/lib/router/layer.js:71:5)
    at trim_prefix (/app/node_modules/express/lib/router/index.js:315:13)
    at /app/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
    at Function.process_params (/app/node_modules/@sentry/tracing/cjs/integrations/node/express.js:273:34)
        -> /app/node_modules/src/integrations/node/express.ts:342:1
    at next (/app/node_modules/express/lib/router/index.js:275:10)
    at Layer.handle_error (/app/node_modules/express/lib/router/layer.js:67:12)
    at trim_prefix (/app/node_modules/express/lib/router/index.js:315:13)
    at /app/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
    at Function.process_params (/app/node_modules/@sentry/tracing/cjs/integrations/node/express.js:273:34)
        -> /app/node_modules/src/integrations/node/express.ts:342:1
    at next (/app/node_modules/express/lib/router/index.js:275:10)
    at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:97:5)
    at trim_prefix (/app/node_modules/express/lib/router/index.js:317:13)
    at /app/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
    at Function.process_params (/app/node_modules/@sentry/tracing/cjs/integrations/node/express.js:273:34)
        -> /app/node_modules/src/integrations/node/express.ts:342:1
    at next (/app/node_modules/express/lib/router/index.js:275:10)
    at expressInit (/app/node_modules/express/lib/middleware/init.js:40:5)
    at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/app/node_modules/express/lib/router/index.js:317:13)
    at /app/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)

I can get rid of the error if I remove this line during the sentry setup:
app.use(Sentry.Handlers.requestHandler());

@Lms24
Copy link
Member

Lms24 commented Nov 14, 2022

Hi @BenGale thanks for writing in.

Can you confirm that all your @sentry/* packages are on the same version (7.19.0)? I'd just like to rule out that this is caused by a version mismatch.

@BenGale
Copy link
Author

BenGale commented Nov 14, 2022

I am, and yes it's on the same 7.19.0 version.

@Lms24
Copy link
Member

Lms24 commented Nov 14, 2022

I haven't been able to reproduce this so far but I found one thing that strikes me as interesting:

at Hub.withScope (/app/node_modules/@sentry/hub/dist/hub.js:85:13)
       -> /app/node_modules/@sentry/hub/src/hub.ts:154:7

We recently removed @sentry/hub in 7.15.0 (#5823) from the list of dependencies and moved all the code into @sentry/core.
So I don't entirely know why it still appears in your stack trace. Are you importing/requiring anything from @sentry/hub?
Also, I'm wondering about the dist/hub.js part in the stack frame. This doesn't look like a normal directory inside our tarball to me.

So I'm wondering if there is some problem with this change or maybe with your node_modules folder. Would you mind trying to delete node_modules and install your dependencies again? Are you using a bundler or some sort of minification/mangling plugin?

@BenGale
Copy link
Author

BenGale commented Nov 14, 2022

I think that has solved it, I had to turf a bunch of stuff out of the yarn.lock file. Thats what I think you're seeing too in the paths, its hoisting the dependencies since we're in a monorepo.

I cleared it out and it re-added some but for newer versions:
image

Will do more testing, but it seems to be working now 🤞.

@Lms24
Copy link
Member

Lms24 commented Nov 14, 2022

Ahh that makes a lot of sense to me then. The path I was talking about above (dist/hub.js) did exist in pre v7 versions.

I'm gonna close this issue for now but feel free to ping me if you still have problems.

@Lms24 Lms24 closed this as completed Nov 14, 2022
@BenGale
Copy link
Author

BenGale commented Nov 14, 2022

Thanks for your help.

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

No branches or pull requests

2 participants