-
-
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
PrivateCpuProfilerBindings.startProfiling is not a function #14561
Comments
Hey @jbreckel thanks for writing in! Are you running your lambda function in ESM or CJS? Can you confirm that all your |
lambdas are running CJS, new lambdaNodeJs.NodejsFunction(
this,
`SomeLambda`,
{
functionName: `${this.prefix}-some-lambda`,
entry: `src/aws/lambda/some-lambda.ts`,
runtime: lambda.Runtime.NODEJS_20_X,
logRetention: logs.RetentionDays.ONE_WEEK,
architecture: lambda.Architecture.ARM_64,
bundling: {
loader: {
'.node': 'file',
},
commandHooks: {
beforeBundling: () => [],
beforeInstall: () => [],
afterBundling: (_, outputDir) => [
`sentry-prune-profiler-binaries --target_platform=linux --target_arch=arm64 --target_node=20 --target_stdlib=glibc --target_dir_path=${outputDir}`,
],
},
},
environment: {
SENTRY_ENV: this.awsStage,
SENTRY_RELEASE: `${this.prefix}-${this.awsStage}`,
SENTRY_DSN: Context.tryGetContext<string>(
this.node,
'sentryDSN'
),
},
}
); Yes, they are all pinned |
Correct me if I'm wrong but it looks like you're using some kind of wrapper around your lambda function handler? Is this a library or some framework? Any chance you could provide a minimal reproduction for this? Also gonna cc @JonasBa - have you seen this error before by chance? |
The only wrapper is the sentry |
https://github.com/jbreckel/sentry-profiling-reproduction I may be using the wrong |
We'll look at this, thanks for the reproduction! I have to admit I've never seen a lambda definition like this (though my AWS knowledge is limited as well) and the fact that it mentions "bundling" worries me a bit with opentelemetry instrumentation. This shouldn't cause the issue with profilling though. @JonasBa has the most context around profiling so hopefully we get to this soonish. For the moment, you should be good if you remove the profiling integration. |
how is this related? Is there an update required as well? |
Hmm ok so digging a bit into this, I suspect it is indeed related to the loading of the @jbreckel have you tried if removing the |
does not change anything. I was also confused about that part, maybe there was an adjustment in the functionname and it is no longer called edit: sentry-javascript/packages/profiling-node/bindings/cpu_profiler.cc Lines 1178 to 1184 in 67b8d3e
|
I don't know how this works in detail tbh or if/how you can read the cpp debug logs. However, if I understand the linked code correctly, there actually is a chance that |
I opened #14676 to guard the invocation of the functions with a |
@jbreckel the native method is I think what ends up happening here is that we fail to expose the binding and you are correct that an error should be thrown. Are you seeing any errors being throw here that would correspond to the missing startProfiling call? @jbreckel would you mind sharing what platform or provider are you running this on? I might take a look if there are similar issues that others have reported |
the setup we are using is the same as in the repo linked above.
if that is what your are referring to?
|
@jbreckel I was going to ask where do you deploy the infra? Is it AWS lambda? The reason I ask is that in some cases, the runtime can be backed by a different engine that might not be compatible with everything we require and I wanted to see if whatever provider you use has some documentation around native binaries |
I merged #14676 which will go out with version 8.45.0 soon. While this doesn't fix the root cause, it should keep your lambda from throwing the error as it will simply bail out if the binary wasn't loaded correctly. |
we are using aws lambda just as the example repo shows. also without the pruning of binaries the error continues to randomly appear.
thanks! |
Is there an existing issue for this?
How do you use Sentry?
Self-hosted/on-premise
Which SDK are you using?
@sentry/node
SDK Version
8.41.0
Framework Version
No response
Link to Sentry event
No response
Reproduction Example/SDK Setup
AWS Lambda Node 20
Steps to Reproduce
Expected Result
get a reproducible result.
~ 4 out of 10 times the below described error gets thrown
Actual Result
sometimes a
TypeError
is thrown, most times notThe text was updated successfully, but these errors were encountered: