我们有几个带有AWS X-Ray的NodeJS Lambdas,一般设置如下。
process.env.AWS_XRAY_DEBUG_MODE = 'TRUE'
process.env.AWS_XRAY_TRACING_NAME = 'api-extensions'
console.log('Enabled XRAY debug mode')
import AWSXRay from 'aws-xray-sdk-core'
import { inputHandler } from './lib/handler'
import Sentry from './lib/sentry'
if (process.env.AWS_XRAY_ENABLED) {
AWSXRay.captureHTTPsGlobal(require('http'), true)
AWSXRay.captureHTTPsGlobal(require('https'), true)
AWSXRay.capturePromise() <----- causes the startup messages
}
export const handler = Sentry.wrapHandler(inputHandler)
所有这些lambda在启动时(初始化期间)给予我以下错误之一:
Missing AWS Lambda trace data for X-Ray. Ensure Active Tracing is enabled and no subsegments are created outside the function handler
或
Missing AWS Lambda trace data for X-Ray. Expected _X_AMZN_TRACE_ID to be set
我的理解是,我们需要capturePromise()作为axios
依赖项。|
我想知道这些信息是从哪里来的,我如何修复它们。
相关详细信息(将根据需求/要求添加):
- AWS_XRAY_ENABLED已设置
- 软件包版本:
aws-xray-sdk-core": "3.3.1"
1条答案
按热度按时间gtlvzcf81#
您应该验证Lambda正在使用的角色是否具有足够的xray:* 资源的权限: