-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
docs(js): Update AWS Lambda quick start guide #15150
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
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
// Wrap your handler with Sentry | ||
exports.handler = Sentry.wrapHandler(async (event, context) => { | ||
// Your handler code | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bundle ReportChanges will increase total bundle size by 249 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: sentry-docs-server-cjsAssets Changed:
view changes for bundle: sentry-docs-client-array-pushAssets Changed:
|
// Wrap your handler with Sentry | ||
exports.handler = Sentry.wrapHandler(async (event, context) => { | ||
// Your handler code | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential bug: The ESM example in the AWS Lambda guide uses incorrect CommonJS syntax (exports.handler
), which will cause a runtime error in an ESM environment.
-
Description: The documentation for setting up Sentry with AWS Lambda for ESM modules provides an incorrect code snippet. It uses
exports.handler = ...
, which is CommonJS syntax. In an ESM environment, this will cause aReferenceError: exports is not defined
because theexports
object is not available. This guarantees that any Lambda function configured following this specific guide will fail at runtime. The correct syntax for ESM isexport const handler = ...
. -
Suggested fix: Update the ESM code example in the AWS Lambda documentation. Replace the incorrect CommonJS syntax
exports.handler = Sentry.wrapHandler(...)
with the correct ESM syntaxexport const handler = Sentry.wrapHandler(...)
.
severity: 0.8, confidence: 0.95
Did we get this right? 👍 / 👎 to inform future reviews.
@inventarSarah the current quickstart we have is already the latest. @msonnb was working on this over the summer and it represents the state we want it to be in. |
DESCRIBE YOUR PR
This branch contains the updated Quick Start guide for AWS Lamda https://docs.sentry.io/platforms/javascript/guides/aws-lambda/
I used content from this page, which only includes Tracing and Error Monitoring in the onboarding options. Let me know if we can add others (+the relevant environment var names)
Closes: #15108
IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs to go live.
SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST
Make sure you've checked the following before merging your changes:
EXTRA RESOURCES