-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Package: serverlessIssues related to the Sentry Serverless SDKIssues related to the Sentry Serverless SDK
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/serverless
SDK Version
7.85.0
Framework Version
NodeJS 18.18.2
Link to Sentry event
No response
SDK Setup
Docker file:
FROM public.ecr.aws/lambda/nodejs:18.2023.11.18.01-x86_64
ENV HOME=/tmp
ENV NODE_ENV production
# Lambda insights
RUN curl -O https://lambda-insights-extension.s3-ap-northeast-1.amazonaws.com/amazon_linux/lambda-insights-extension.rpm && \
rpm -U lambda-insights-extension.rpm && \
rm -f lambda-insights-extension.rpm
COPY --from=public.ecr.aws/sentry/sentry-node-serverless-sdk:28 /opt/ /opt
COPY ./package.json ${LAMBDA_TASK_ROOT}/
COPY ./yarn.lock ${LAMBDA_TASK_ROOT}/
RUN cd ${LAMBDA_TASK_ROOT}/ && corepack enable && yarn install --production --frozen-lockfile --silent --non-interactive
COPY ./ ${LAMBDA_TASK_ROOT}/
CMD [ "index.handler" ]
Lambda environment variables:
AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
NODE_OPTIONS: -r @sentry/serverless/dist/awslambda-auto
SENTRY_DSN: VALID_DSN_LINK
SENTRY_ENVIRONMENT: test
SENTRY_TRACES_SAMPLE_RATE: 0.2
JS code:
import Sentry from "@sentry/serverless";
import { ProfilingIntegration } from "@sentry/profiling-node";
const isLambda = !!process.env.LAMBDA_TASK_ROOT;
Sentry.AWSLambda.init({
integrations: [
new ProfilingIntegration(),
],
enabled: isLambda,
});
const internalHandler = async () => {
Sentry.captureMessage("TEST: catch me if you can")
}
export const handler = Sentry.AWSLambda.wrapHandler(async (event = {}) => {
await internalHandler();
return {
success: true
}
}, { captureAllSettledReasons: true });
Package.json
{
"name": "testing",
"description": "Testing",
"type": "module",
"module": "index.mjs",
"packageManager": "yarn@1.22.19",
"dependencies": {
"@sentry/profiling-node": "^1.2.6",
"@sentry/serverless": "^7.85.0"
}
}
Steps to Reproduce
- Create a nodejs project folder with an index.mjs and package.json. Put in the content in the index file and the example package.json in the package.json. Run
yarn install
locally to create ayarn.lock
file. - Create the docker file and upload to an AWS ECR repo.
- Create a lambda with the docker image and environment parameters.
- Run lambda.
Expected Result
A workable Sentry environment.
Also, I find it strange that the nodejs lambda layers are updated weekly, but the Sentry AWS Lambda Container Image is already idle for 2 years.
Actual Result
Copy and paste of AWS CloudWatch logs, therefore formatting is not the best.
2023-12-06T10:18:06.093Z undefined ERROR TypeError: core.getCurrentHub(...).getScope(...).setPropagationContext is not a function at updateScopeFromEnvVariables (/var/task/node_modules/@sentry/node/cjs/sdk.js:267:37) at Object.init (/var/task/node_modules/@sentry/node/cjs/sdk.js:171:3) at Object.init (/var/task/node_modules/@sentry/serverless/cjs/awslambda.js:46:10) at file:///var/task/index.mjs:7:18 at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
2023-12-06T10:18:06.094Z undefined Uncaught Exception {
"errorType": "TypeError",
"errorMessage": "core.getCurrentHub(...).getScope(...).setPropagationContext is not a function",
"stack": [
"TypeError: core.getCurrentHub(...).getScope(...).setPropagationContext is not a function",
" at updateScopeFromEnvVariables (/var/task/node_modules/@sentry/node/cjs/sdk.js:267:37)",
" at Object.init (/var/task/node_modules/@sentry/node/cjs/sdk.js:171:3)",
" at Object.init (/var/task/node_modules/@sentry/serverless/cjs/awslambda.js:46:10)",
" at file:///var/task/index.mjs:7:18",
" at ModuleJob.run (node:internal/modules/esm/module_job:194:25)"
]
}
Metadata
Metadata
Assignees
Labels
Package: serverlessIssues related to the Sentry Serverless SDKIssues related to the Sentry Serverless SDK
Type
Projects
Status
No status