-
-
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
AWS Lambda Serverless Framework v4 Sentry Errors with nodeProfilingIntegration #13973
Comments
This looks very much related to the recent added documentation about the node profiler using process.env variables to resolve the profiler path (My issue: getsentry/sentry-docs#11128). I use webpack, so the comments below will be different for esbuild, but hopefully it contains all information to adjust your own config. I resolved this by copying the sentry_cpu_profiler* files to the dist folder (webpack output) and setting the env variables within the config.
As bonus I trim the copied cpu profiles files by running (change to your lambda target):
My webpack copy code snippet:
Be aware that you keep other process.env references intact when building with esbuild, as lambda plugins might read the lambda environment variables for specific code execution |
Hello @k-lombard, thanks for writing in. As mentioned in a related comment here, There are a couple of approaches here you could take. One is the create a dedicated Thank you so much for chiming in and helping out @Jimmy89! cc @JonasBa |
@andreiborza @Jimmy89 Even if I turn off nodeProfiling in my sentry_init.js, I still get errors of this type though:
Are you aware of how to fix the ENOENT errors? From what I read I assumed it was related to sourcemaps. Also, @Jimmy89 is the method via which you copy the profiler files to the dist a script in your CI/CD pipeline? Or how are you handling that? Furthermore, the error events that are sent to sentry currently do not have a corresponding stack trace for my lamdba functions. And all my lambas are wrapped in wrapHandler: I was able to setup sourcemaps with this esbuild config. I tried doing what you mentioned for esbuild, but couldnt seem to get it working. Im still getting the same error. esbuild.config.js
sentry_init.js:
|
@k-lombard can you try turning debug on in the |
@andreiborza I dont know if Ill be able to make a reproduction repo but I have turned on debug on both. Where should I be looking for sentry-esbuild-plugin logs? When I deploy my lambda I see some logs for the plugin but no errors/warnings or anything. |
@k-lombard maybe you could spot anything with |
@k-lombard in our pipeline we do the full yarn install, webpack build and uploading the generated dist folder (containing all files) as zip file to s3 (we use Pulumi to update the function). Looking at your error messages, I have the feeling that esbuild has not resolved dynamic imports, transpiled files should for example not require |
@Jimmy89 hmmm yeah I probably need to find someone who knows how to fix these issues for Serverless v4 Framework with the built-in esbuild. I tried a ton of different fixes over the last week with nothing working. Hopefully this becomes somewhat of a priority for the Sentry team soon. If not, my team might have to migrate off of sentry. @chargome |
Hello, this is hard to debug without a minimal reproduction example. Are you able to provide one? And can you share the logs you are getting? |
@k-lombard the issue in esbuild with dynamic imports shouldn't cause an issue here. What happens is that if esbuild sees a dynamic import, it wont invoke the loader and copy the binary as it cant eagerly evaluate the expression. Have you tried marking the package as external like @andreiborza recommended here? If you are using esbuild, you will have to also make sure you exclude |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you remove the label "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/aws-serverless
SDK Version
8.27.0
Framework Version
nodejs20.x
Link to Sentry event
No response
Reproduction Example/SDK Setup
Using the Serverless Framework v4 with AWS Lambdas.
This leads to this error and my lambdas don't work (only when I include nodeProfilingIntegration)
If I remove nodeProfilingIntegration, my lambdas at least function, but I see TONS of "Sentry Logger [error]" everywhere in my lambda logs.
Those errors look like this:
Steps to Reproduce
Using Serverless Framework v4 with esbuild to write and deploy my AWS Lambda functions.
Here's my package.json:
The lambdas are written in typescript and bundled with the built-in esbuild with serverless v4 in
sls deploy
Expected Result
Expected result is for node profiling to work and to not have tons of random sentry errors everywhere in my lambda logs.
Actual Result
Logs attached above.
The text was updated successfully, but these errors were encountered: