Skip to content

[useSentry] @sentry/ >= 6.18.x causes runtime error #1342

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

Closed
4 tasks
AzSiAz opened this issue Mar 23, 2022 · 18 comments
Closed
4 tasks

[useSentry] @sentry/ >= 6.18.x causes runtime error #1342

AzSiAz opened this issue Mar 23, 2022 · 18 comments
Labels
kind/bug Something isn't working stage/0-issue-prerequisites Needs more information before we can start working on it

Comments

@AzSiAz
Copy link

AzSiAz commented Mar 23, 2022

Issue workflow progress

Progress of the issue based on the Contributor Workflow

  • 1. The issue provides a minimal reproduction available on Stackblitz.
    • Please install the latest @envelop/* packages that you are using.
    • Please makee sure the reproduction is as small as possible.
  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug
While refactoring my code to use Pothos, I noticed using @envelop/sentry result in

{
  "errors": [
    {
      "message": "Cannot read properties of undefined (reading 'setData')"
    }
  ]
}

To Reproduce
Just use sentry plugin with Pothos framework, exemple repo
https://stackblitz.com/edit/node-qabanz?file=package.json

Expected behavior
No Error

Environment:

  • OS: MacOS
  • NodeJS: 17 & 16
  • @envelop/sentry: 3.1.1
  • @envelop/core: 2.1.0

Additional context
I am also using this as server
@graphql-ez/express: 0.9.7,
@graphql-ez/plugin-websockets: 0.10.4,

@n1ru4l n1ru4l added the kind/bug Something isn't working label Mar 24, 2022
@MattiaPette
Copy link

MattiaPette commented Mar 24, 2022

Hi, I've noticed the same error in my local environment (a simple test project using envelop + sentry), and downgrading @sentry/node and @sentry/tracing to 6.18.1 fixed this for me, the version 6.18.2 doesn't work so the bug may be related to that particular version.

@AzSiAz
Copy link
Author

AzSiAz commented Mar 24, 2022

I am also using the latest version of sentry, but I didn't notice any problem with nexus 🤔
I will try later today just in case i missed it

If downgrading sentry is the way to temporary fix this, then perfect I will just wait until upgrading it again until a fix is issued

@AzSiAz
Copy link
Author

AzSiAz commented Mar 25, 2022

I tested with 6.18.1 for sentry package and 3.1.1 for @envelop/sentry and it's working as @MattiaPette said

@n1ru4l
Copy link
Collaborator

n1ru4l commented Mar 25, 2022

Hey, I updated the issue with the workflow progress for resolving it.

@n1ru4l n1ru4l added the stage/0-issue-prerequisites Needs more information before we can start working on it label Mar 25, 2022
@AzSiAz
Copy link
Author

AzSiAz commented Mar 30, 2022

I edited my post with a reproduction

@n1ru4l
Copy link
Collaborator

n1ru4l commented Mar 30, 2022

I reduced the reproduction further in https://stackblitz.com/edit/node-kwtsm9?file=src/index.ts

This is not related to pothos at all. I will update the title of this issue.

@n1ru4l n1ru4l changed the title Sentry plugin + Pothos is not working [useSentry] @sentry/ >= 6.18.x causes runtime error Mar 30, 2022
@AzSiAz
Copy link
Author

AzSiAz commented Mar 30, 2022

True, thanks for the update

@pi0neerpat
Copy link

In case anyone else encounters this in a RedwoodJS project, hre's what worked for me after nuking node_modules, yarn.lock, and /dist.

    "@envelop/rate-limiter": "^1.0.0",
    "@envelop/sentry": "^3.1.1",
    "@redwoodjs/api": "^0.50.0",
    "@redwoodjs/graphql-server": "^0.50.0",
    "@sentry/node": "6.18.1",
    "@sentry/tracing": "6.18.1",

@HashDot
Copy link

HashDot commented Mar 31, 2022

I have the same problem with the following packages:

    "@envelop/graphql-jit": "^4.1.0",
    "@envelop/sentry": "^3.1.1",
    "@graphql-yoga/node": "^2.0.0",
    "@sentry/node": "^6.18.1",
    "@sentry/tracing": "^6.18.1",

I tested it with the latest versions and with this downgrade fix. Nothing works.

@n1ru4l
Copy link
Collaborator

n1ru4l commented Mar 31, 2022

@HashDot ^6.18.1 will resolve to 6.19.3. You need to pin to the exact version 6.18.1.

See https://semver.npmjs.com/ for more information as well as https://docs.npmjs.com/about-semantic-versioning

In regards to fixing this issue, it seems like there is an unexpected breaking change within sentry. I quickly scanned the sentry issues but could not find one. I will dedicate more time to this issue next week. In the meantime, any help or research (of the sentry changes) is highly appreciated.

@HashDot
Copy link

HashDot commented Mar 31, 2022

@n1ru4l ty. my bad :)

@n1ru4l
Copy link
Collaborator

n1ru4l commented Apr 7, 2022

This is linked to getsentry/sentry-javascript#4731

I created #1367 with a failing test.

Currently, a workaround seems to be adding a import "@sentry/tracing".

@n1ru4l
Copy link
Collaborator

n1ru4l commented Apr 20, 2022

@HashDot @AzSiAz @pi0neerpat @MattiaPette can anyone confirm whether this is solved with sentry version 6.19.4 getsentry/sentry-javascript#4731 (comment)?

@MattiaPette
Copy link

Hi @n1ru4l !
I've updated to @envelop/core@^2.3.1, @envelop/sentry@^3.4.0, @sentry/node@^6.19.6, @sentry/tracing@^6.19.6 and it's not causing any runtime errors in my project in the limited testing i've done.

Version 6.19.4 works as well with the same results.

Only thing that I'm noticing has changed right now is this log:

Sentry Logger [log]: Integration installed: InboundFilters
Sentry Logger [log]: Integration installed: FunctionToString
Sentry Logger [log]: Integration installed: ContextLines
Sentry Logger [log]: Integration installed: Console
Sentry Logger [log]: Integration installed: OnUncaughtException
Sentry Logger [log]: Integration installed: OnUnhandledRejection
Sentry Logger [log]: Integration installed: LinkedErrors
Sentry Logger [log]: Integration installed: Http
Sentry Logger [error]: Mongo Integration was unable to require `mongodb` package.
Sentry Logger [log]: Integration installed: Mongo

It's probably not related to this issue, will try to investigate further and open another issue if it's needed.

@AzSiAz
Copy link
Author

AzSiAz commented Apr 20, 2022

Still need to import import '@sentry/tracing' as soon as I use useSentry from @envelop/sentry (v3.4.0) and I make a query
No bundler on my side just ts-node-dev and tsc to build production version
Tested with @sentry/node & @sentry/tracing version 6.19.4 and 6.19.6 (with fresh node module install)

@n1ru4l
Copy link
Collaborator

n1ru4l commented Apr 20, 2022

I am also still experiencing the same issues on 6.19.6 😢 (getsentry/sentry-javascript#4731 (comment))

@jycouet
Copy link
Contributor

jycouet commented Jun 2, 2022

Hi @n1ru4l ! I've updated to @envelop/core@^2.3.1, @envelop/sentry@^3.4.0, @sentry/node@^6.19.6, @sentry/tracing@^6.19.6 and it's not causing any runtime errors in my project in the limited testing i've done.

Version 6.19.4 works as well with the same results.

Only thing that I'm noticing has changed right now is this log:

Sentry Logger [log]: Integration installed: InboundFilters
Sentry Logger [log]: Integration installed: FunctionToString
Sentry Logger [log]: Integration installed: ContextLines
Sentry Logger [log]: Integration installed: Console
Sentry Logger [log]: Integration installed: OnUncaughtException
Sentry Logger [log]: Integration installed: OnUnhandledRejection
Sentry Logger [log]: Integration installed: LinkedErrors
Sentry Logger [log]: Integration installed: Http
Sentry Logger [error]: Mongo Integration was unable to require `mongodb` package.
Sentry Logger [log]: Integration installed: Mongo

It's probably not related to this issue, will try to investigate further and open another issue if it's needed.

Did you try adding npm i mongodb?
But yes, I think also it' snot linked to this issue.

@n1ru4l
Copy link
Collaborator

n1ru4l commented Jun 4, 2022

So according to getsentry/sentry-javascript#4731 (comment), Sentry, unfortunately, shipped a major breaking change in a minor/patch release.

I updated the documentation to reflect that change in #1407.

@n1ru4l n1ru4l closed this as completed Jun 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working stage/0-issue-prerequisites Needs more information before we can start working on it
Development

No branches or pull requests

6 participants