Hi all, trying to setup sentry with my lambda func...
# help
k
Hi all, trying to setup sentry with my lambda functions. I got it working on the frontend fine, but the instructions here https://serverless-stack.com/examples/how-to-use-sentry-to-monitor-your-serverless-app.html are not clear at Head over to the Sentry docs and get the layer they provide. Select your region and copy the layer ARN. Im not sure what im supposed to do here though. Any chance on a steer if anyone else has managed to set this up ?
t
here is my setup
Copy code
import { StackContext } from "@serverless-stack/resources"
import { LayerVersion } from "aws-cdk-lib/aws-lambda"

export function Sentry(props: StackContext) {
  if (props.app.local) return
  const sentry = LayerVersion.fromLayerVersionArn(
    props.stack,
    "SentryLayer",
    `arn:aws:lambda:${props.app.region}:943013980633:layer:SentryNodeServerlessSDK:35`
  )

  props.app.addDefaultFunctionLayers([sentry])
  props.app.addDefaultFunctionEnv({
    SENTRY_DSN:
      "<DSN>",
    SENTRY_TRACES_SAMPLE_RATE: "1.0",
    SENTRY_ENVIRONMENT: props.app.stage,
    NODE_OPTIONS: "-r @sentry/serverless/dist/awslambda-auto",
  })
}
in that link on sentry there's a dropdown to select your region
k
thanks so much @thdxr!