-
-
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
nodeProfilingIntegration from @sentry/profiling-node does not work in aws lambda #12994
Comments
@petar-ps would you mind sharing a small reproducible example with us please? It seems like this fails at attempting to require the bindings file in ESM mode, but it's a bit hard to say exactly why this would happen without attempting to reproduce it. Thanks so much! |
Here is the repo: https://github.com/petar-ps/sentry-problem If you dont have AWS SAM, you can download zip file and create lambda, then import from this zip. Go to Test it and you will see similar error: |
Hello, thanks for the reproduction, we are taking a look at this! |
Hello @petar-ps, thanks for filing this and providing a reproduction. We've had a look at this and the issue is twofold.
We don't provide a layer for You'll also have to mark # template.yaml
...
Metadata: # Manage esbuild properties
BuildMethod: esbuild
BuildProperties:
External:
- '@sentry/profiling-node' Please let us know if you're still having problems after trying this. |
Thank you @andreiborza. It works. Just to send this message if someone have the same problem like me for the future with AWS SAM and typescript. Building and using the same layers from local is broken in AWS SAM. Yes, you can build and deploy a layer from SAM but you cannot use it. You must include that deployed layer like this inside your options for your function: In template.yaml:
Other things to consider is typescript will warn you when you try to import something from /opt/nodejs/node_modules/yourFile so you have 2 options:
This will shut TS mouth. But again in local invoke or aws invoke, amazon will provide that path for you so this is really cosmetic in my opinion. If you are using functions from that package in the code, then its not cosmetic because you will get completition for that code. One more thing. Watch how do you reference layers. I built my layer with SAM and SAM build with structure nodejs/ instead of nodejs/node18 so be careful how do you reference your layer. |
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.19.0
Framework Version
Node 20.14/Node 18
Link to Sentry event
There is no event
SDK Setup/Reproduction Example
Steps to Reproduce
Aws sam build the lambda but when i invoke locally or on via amazon server it just crash on start up.
Expected Result
To finish init and continue execution.
Actual Result
Lambda crash on start up. nodeProfilingIntegration() crash.
LOG:
The text was updated successfully, but these errors were encountered: