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

Postgres Integration was unable to require pg package when using webpack #4099

Closed
riha opened this issue Oct 28, 2021 · 2 comments
Closed

Postgres Integration was unable to require pg package when using webpack #4099

riha opened this issue Oct 28, 2021 · 2 comments

Comments

@riha
Copy link

riha commented Oct 28, 2021

Package + Version

  • "@sentry/node": "^6.13.3"
  • "@sentry/tracing": "^6.13.3"
  • "webpack": "^5.60.0"
  • "webpack-cli": "^4.9.1"

This is similar to issue found here (issue 3293) with a workaround from @kamilogorek. I can't however get the workaround to work.

Issue

When trying to use the Tracing.Integrations.Postgres() integration to get database traces the pg package can for some reason not be required.

CleanShot 2021-10-28 at 14 20 13@2x

CleanShot 2021-10-28 at 14 20 52@2x

Previously proposed workaround

In issue 3293 the mentioned workaround is to add magic comments

module: {
  parser: {
    javascript: {
      commonjsMagicComments: true,
    },
  },

Even with workaround implemented I still however get the exact same error ...

Sentry Logger [Error]: Postgres Integration was unable to require pg package.

Reproduce the issue

👀 A repo for reproducing the issue can be found here

@lobsterkatie
Copy link
Member

Hi, @riha. Sorry you're running into this!

Can you try the fixes in #4077 and #4083 in your local copy of the SDK to see if either one fixes it?

(They will likely both be in the next release (slated for next week), so you also could wait and try it that way . You also might try 6.12.x, as #4083 fixes a bug introduced in 6.13.0.)

@riha
Copy link
Author

riha commented Oct 29, 2021

Thanks @lobsterkatie.

I actually think I'll move away from Webpack on this one though. Don't really need to bundle the node app for what I'm doing and it might even be overkill.

But I guess it'd be good to have working for that scenario anyways 😎 Especially as the docs mentions and shows examples using Webpack in a number of places.

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

No branches or pull requests

3 participants