newrelic 13.8.0 → 13.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/NEWS.md CHANGED
@@ -1,3 +1,13 @@
1
+ ### v13.8.1 (2025-12-15)
2
+
3
+ #### Bug fixes
4
+
5
+ * Updated AWS Lambda instrumentation to skip wrapping handler callback if not present ([#3602](https://github.com/newrelic/node-newrelic/pull/3602)) ([d56e27d](https://github.com/newrelic/node-newrelic/commit/d56e27d5764b4c0a7d513fffa3310148d7cebea6))
6
+
7
+ #### Documentation
8
+
9
+ * Updated compatibility report ([#3596](https://github.com/newrelic/node-newrelic/pull/3596)) ([ed24527](https://github.com/newrelic/node-newrelic/commit/ed24527cfd2e836de67a769cbeaa63683b207506))
10
+
1
11
  ### v13.8.0 (2025-12-11)
2
12
 
3
13
  #### Features
@@ -200,14 +200,13 @@ class AwsLambda {
200
200
  return handler.apply(this, args)
201
201
  }
202
202
 
203
- const event = args[0]
204
- const context = args[2]
203
+ const [event, responseStream, context] = args
205
204
  logger.trace('In stream handler, lambda function name', context?.functionName)
206
205
  const { segment, txnEnder } = awsLambda.createSegment({ context, event, transaction, recorder: recordBackground })
207
206
  args[1] = awsLambda.wrapStreamAndCaptureError(
208
207
  transaction,
209
208
  txnEnder,
210
- args[1]
209
+ responseStream
211
210
  )
212
211
 
213
212
  let res
@@ -238,8 +237,7 @@ class AwsLambda {
238
237
  return handler.apply(this, args)
239
238
  }
240
239
 
241
- const event = args[0]
242
- const context = args[1]
240
+ const [event, context, callback] = args
243
241
  logger.trace('Lambda function name', context?.functionName)
244
242
  const isApiGatewayLambdaProxy = apiGateway.isLambdaProxyEvent(event)
245
243
  logger.trace('Is this Lambda event an API Gateway or ALB web proxy?', isApiGatewayLambdaProxy)
@@ -256,16 +254,24 @@ class AwsLambda {
256
254
  setWebRequest(transaction, webRequest)
257
255
  resultProcessor = getApiGatewayLambdaProxyResultProcessor(transaction)
258
256
  }
259
- const cbIndex = args.length - 1
260
- args[cbIndex] = awsLambda.wrapCallbackAndCaptureError(
261
- transaction,
262
- txnEnder,
263
- args[cbIndex],
264
- resultProcessor
265
- )
257
+
258
+ if (typeof callback === 'function') {
259
+ logger.trace('Wrapping Lambda handler callback')
260
+ const cbIndex = args.length - 1
261
+ args[cbIndex] = awsLambda.wrapCallbackAndCaptureError(
262
+ transaction,
263
+ txnEnder,
264
+ callback,
265
+ resultProcessor
266
+ )
267
+ } else {
268
+ logger.trace('Lambda handler callback not present, skip wrapping')
269
+ }
266
270
 
267
271
  // context.{done,fail,succeed} are all considered deprecated by
268
272
  // AWS, but are considered functional.
273
+ // TODO: Remove when we drop Node.js 22
274
+ // see: https://aws.amazon.com/blogs/compute/node-js-24-runtime-now-available-in-aws-lambda/
269
275
  context.done = awsLambda.wrapCallbackAndCaptureError(transaction, txnEnder, context.done)
270
276
  context.fail = awsLambda.wrapCallbackAndCaptureError(transaction, txnEnder, context.fail)
271
277
  shim.wrap(context, 'succeed', function wrapSucceed(shim, original) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newrelic",
3
- "version": "13.8.0",
3
+ "version": "13.8.1",
4
4
  "author": "New Relic Node.js agent team <nodejs@newrelic.com>",
5
5
  "license": "Apache-2.0",
6
6
  "contributors": [