Skip to content

Conversation

inventarSarah
Copy link
Collaborator

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.

  • Urgent deadline (GA date, etc.):
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

EXTRA RESOURCES

Copy link

vercel bot commented Oct 7, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sentry-docs Ready Ready Preview Comment Oct 7, 2025 11:54am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
develop-docs Ignored Ignored Oct 7, 2025 11:54am

// Wrap your handler with Sentry
exports.handler = Sentry.wrapHandler(async (event, context) => {
// Your handler code
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: ESM Code Uses Incorrect CommonJS Syntax

The ESM code example (instrument.mjs) incorrectly uses CommonJS exports.handler syntax. This causes a runtime error because exports is not defined in an ES Module context.

Fix in Cursor Fix in Web

Copy link

codecov bot commented Oct 7, 2025

Bundle Report

Changes will increase total bundle size by 249 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-client-array-push 10.15MB -6 bytes (-0.0%) ⬇️
sentry-docs-server-cjs 12.96MB 255 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: sentry-docs-server-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
1729.js -3 bytes 1.78MB -0.0%
../instrumentation.js -3 bytes 1.1MB -0.0%
9523.js -3 bytes 1.08MB -0.0%
../app/[[...path]]/page.js.nft.json 88 bytes 852.86kB 0.01%
../app/platform-redirect/page.js.nft.json 88 bytes 852.78kB 0.01%
../app/sitemap.xml/route.js.nft.json 88 bytes 850.01kB 0.01%
view changes for bundle: sentry-docs-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
static/chunks/pages/_app-*.js -3 bytes 882.71kB -0.0%
static/chunks/8321-*.js -3 bytes 425.87kB -0.0%
static/rhvOnqu3Kw1rFfR0ixgnx/_buildManifest.js (New) 684 bytes 684 bytes 100.0% 🚀
static/rhvOnqu3Kw1rFfR0ixgnx/_ssgManifest.js (New) 77 bytes 77 bytes 100.0% 🚀
static/6JYh1l9cxnntdAGypVcTR/_buildManifest.js (Deleted) -684 bytes 0 bytes -100.0% 🗑️
static/6JYh1l9cxnntdAGypVcTR/_ssgManifest.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️

Comment on lines +117 to +120
// Wrap your handler with Sentry
exports.handler = Sentry.wrapHandler(async (event, context) => {
// Your handler code
});
Copy link
Contributor

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 a ReferenceError: exports is not defined because the exports object is not available. This guarantees that any Lambda function configured following this specific guide will fail at runtime. The correct syntax for ESM is export 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 syntax export const handler = Sentry.wrapHandler(...).
    severity: 0.8, confidence: 0.95

Did we get this right? 👍 / 👎 to inform future reviews.

@andreiborza
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create AWS Lambda (JS) Quick Start guide
2 participants