Skip to content

Cannot resolve dependency 'perf_hooks' in @sentry/serverless #2942

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
5 of 9 tasks
martsie opened this issue Sep 28, 2020 · 3 comments
Closed
5 of 9 tasks

Cannot resolve dependency 'perf_hooks' in @sentry/serverless #2942

martsie opened this issue Sep 28, 2020 · 3 comments

Comments

@martsie
Copy link

martsie commented Sep 28, 2020

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other: @sentry/serverless

Version:

5.25.0

Description

It appears that the bug referenced in #2523 and #2522 and fixed in #2495 was not fixed for the @sentry/serverless library.

/node_modules/@sentry/serverless/esm/awslambda.js:4:28: Cannot resolve dependency 'perf_hooks'
  2 | import { addExceptionMechanism } from '@sentry/utils';
  3 | import { hostname } from 'os';
> 4 | import { performance } from 'perf_hooks';
    |                            ^
  5 | import { types } from 'util';
  6 | const { isPromise } = types;
  7 | /**
error Command failed with exit code 1.

Tried upgrading to 525.0 beta versions and downgrading to 5.23.0 and the same error exists on build.

@kamilogorek
Copy link
Contributor

What bundler are you using here? perf_hooks are only available for Node envs (duuh, its serverless :p), and some bundlers defaults to browser environments skipping some of built-in node packages.

@martsie
Copy link
Author

martsie commented Sep 29, 2020

I'm using parcel and parcel bundler zip to create lambda packages from typescript. Looks like you're right, parcel is excluding native node modules on build. I've switched away from @sentry/serverless in favour of @sentry/node and it's building fine now. Will continue to use that until perf_hooks is removed from this package or I refactor all the lamdas to use a different packager.

@martsie martsie closed this as completed Sep 29, 2020
@kamilogorek
Copy link
Contributor

It appears that it won't be fixed in parcel 1.x.

parcel-bundler/parcel#2775
parcel-bundler/parcel#2921
parcel-bundler/parcel#3620

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

2 participants