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

Sentry.AWSLambda.init doesn't work with Netlify dev #3000

Closed
tysonmatanich opened this issue Oct 25, 2020 · 0 comments · Fixed by #3030
Closed

Sentry.AWSLambda.init doesn't work with Netlify dev #3000

tysonmatanich opened this issue Oct 25, 2020 · 0 comments · Fixed by #3030

Comments

@tysonmatanich
Copy link

I'm using @sentry/[email protected] (docs) with Netlify Functions (@netlify). It works great when deployed to Netlify, however when running locally with > netlify dev it fails with the following error:

{"errorMessage":"Cannot find module 'aws-sdk/global'\nRequire stack:\n- C:\Users...

Simple workaround incase others run into the issue:

const Sentry = require("@sentry/serverless");
if (process.env.NETLIFY_DEV === "true") {
  Sentry.init(settings);
} else {
  Sentry.AWSLambda.init(settings);
}

On a side note, the Sentry.AWSLambda.wrapHandler works fine with Netlify dev.

marshall-lee added a commit to marshall-lee/sentry-javascript that referenced this issue Nov 4, 2020
Initially, I thought there's no need to catch the error of
`require('aws-sdk/global')` because this package is always available on
AWS Lambda and even in the `sam local` emulator.

However, in some environments it could be missing. Examples of such
environments is netlify dev or it could be simply a unit-test environment
without any packages.

Fixes getsentry#3000.
HazAT pushed a commit that referenced this issue Nov 12, 2020
Initially, I thought there's no need to catch the error of
`require('aws-sdk/global')` because this package is always available on
AWS Lambda and even in the `sam local` emulator.

However, in some environments it could be missing. Examples of such
environments is netlify dev or it could be simply a unit-test environment
without any packages.

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

Successfully merging a pull request may close this issue.

2 participants