-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Cannot read property 'finish' of undefined #2984
Comments
I have the same issue with "5.26.0" of "@sentry/serverless", I have to use "5.25.0" for now. |
We have the same issue with 5.26.0, but not with 5.25.0. I tried to create a test to show it, but could not reproduce it in a test case. |
I am in the process of switching from our old Not really related to this issue, but I noticed that the package does not have all TypeScript dependencies set properly so adding the package caused compilation to break until I manually added |
Just to give more details: I saw this when using |
Try adding |
Downgrading to 5.25.0 is resulting in |
After doing some digging, I found that the In any case, I was able to get this working without the error by adding the following before the import * as SentryTracing from '@sentry/tracing';
SentryTracing.addExtensionMethods(); |
I am also experiencing this with |
Any update on this? Pretty old issue and rather serious to not be able to use this lib in its most basic use case according to the manual (without a hack). |
Yeah it seems to be related to webpack tree-shaking feature or something else webpack-related. Could you please provide a webpack configuration that reproduces the issue? Knowing the webpack version and the versions of plugins will be helpful too. Some time ago I experimented with webpack + sentry on aws lambda and everything worked fine so I definitely miss the point how it could be broken. |
We have seen the issue but don't use webpack at all. We are using typescript for the lambda functions but no bundler. |
what build configuration do you use? |
we are deploying using aws-cdk, which zips a folder and uploads it as lambda asset. Our typescript config is the aws-cdk standard. tsconfig:
and here is the change how we tried to switch from
|
Can confirm this issue also happens with regular Webpack builds, currently on const slsw = require('serverless-webpack');
const webpack = require('webpack');
const { stage } = slsw.lib.serverless.service.provider;
const { isLocal } = slsw.lib.webpack;
module.exports = {
entry: slsw.lib.entries,
target: 'node',
context: process.env.PWD,
// Disable verbose logs
stats: stage === 'prod' ? 'errors-only' : 'normal',
devtool: 'source-map',
externals: [ 'aws-sdk' ],
mode: isLocal ? 'development' : 'production',
performance: {
hints: false,
},
node: {
__dirname: false,
},
resolve: {
symlinks: false,
},
optimization: isLocal
? { splitChunks: false, removeEmptyChunks: false, removeAvailableModules: false }
: { minimize: false },
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(stage === 'prod' ? 'production' : 'development'),
'process.env.WEBPACK_ENV': JSON.stringify('WEBPACK'),
}),
],
}; Producing a {
"errorType": "TypeError",
"errorMessage": "Cannot read property 'finish' of undefined",
"stack": [
"TypeError: Cannot read property 'finish' of undefined",
" at Runtime.handler (/var/task/index.js:23207:25)"
]
} Can confirm @asermax's fix appears to resolve this issue, my guess is adding const Sentry = require('@sentry/serverless');
const SentryTracing = require('@sentry/tracing');
SentryTracing.addExtensionMethods();
Sentry.AWSLambda.init({
// dsn: process.env.SENTRY_DSN, // Populated by env var
tracesSampleRate: 1.0,
}); |
This happens with various bundlers (CDK uses esbuild, I use webpack). You can solve this, for now, this way:
If you're using CDK, here's how to add sentry as a layer:
PS: Also make sure to use |
Useful and sometimes required for modules like @sentry/serverless where webpack/esbuild are breaking it. See: getsentry/sentry-javascript#2984
Awesome!! I was waiting for Sentry being available as a layer! Just out of curiosity, how did you find the layer? Is there a github issue or something where this was tracked? |
I just read their docs and found there was a link to the layer. I guess it has been added recently maybe? seen here: |
any chance this is solved yet in a next release? Or is the go to solution to use the layer (which kinda sucks from a versioning standpoint)? |
For
|
sentry-javascript/packages/tracing/src/index.ts Lines 20 to 21 in eb756d2
This package incorrect marked the source file sentry-javascript/packages/tracing/package.json Lines 88 to 90 in eb756d2
|
This is happening to me without using serverless, just the regular Node.js package using TS. |
This helped me a lot. Thanks! |
I'm having this error in
I'm using the AWS lambda Partial failures response
|
@sentry/serverless": "^5.26.0
Version:
Description
0
Good afternoon,
After new release:
The sentry service works, But I'm getting this message in Amazon CloudWatch:
Sentry common file
Lambda file
Error location
The text was updated successfully, but these errors were encountered: