From 43c4de1cf46f69ee628d9ac2a1b15a2cfe0c577d Mon Sep 17 00:00:00 2001 From: J4YM Date: Tue, 9 Nov 2021 12:25:00 +0100 Subject: [PATCH 01/11] feat(serverless/aws-lambda)/Add documentation for captureAllSettledReasons option Follow https://github.com/getsentry/sentry-javascript/pull/4130 --- .../node/guides/aws-lambda/index.mdx | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/platforms/node/guides/aws-lambda/index.mdx b/src/platforms/node/guides/aws-lambda/index.mdx index b80e3ee178234..8d1eb9709846c 100644 --- a/src/platforms/node/guides/aws-lambda/index.mdx +++ b/src/platforms/node/guides/aws-lambda/index.mdx @@ -80,6 +80,36 @@ exports.handler = Sentry.AWSLambda.wrapHandler(yourHandler, { }); ``` + +## Capture all errors when `Promise.allSettled` is returned by the handler +_(New in version ??)_ + +By default, sentry capture the error raised by your handler. +It's possible that your handler returns a `Promise.allSettled` result. +In this case even if one of the messages has failed, no exception will be captured by Sentry. + +The `captureAllSettledReasons` (default: `false`) option capture all promise rejected results. + +```javascript {tabTitle:promiseSettledDefault} +exports.handler = Sentry.AWSLambda.wrapHandler(() => { + return Promise.allSettled([ + Promise.rejected(new Error('first')), + Promise.rejected(new Error('second')) + ]); +}); +// Nothing captured +``` + +```javascript {tabTitle:captureAllSettledReasons} +exports.handler = Sentry.AWSLambda.wrapHandler(() => { + return Promise.allSettled([ + Promise.rejected(new Error('first')), + Promise.rejected(new Error('second')) + ]); +}, {captureAllSettledReasons: true}); +// `first` and `second` errors are captured +``` + ## Behavior With the AWS Lambda integration enabled, the Node SDK will: From f2726587c4f3c5d2ae8bbe12ed3a924d0d523458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Fornarino?= <54641813+J4YF7O@users.noreply.github.com> Date: Tue, 9 Nov 2021 16:37:44 +0100 Subject: [PATCH 02/11] Update src/platforms/node/guides/aws-lambda/index.mdx Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> --- src/platforms/node/guides/aws-lambda/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/node/guides/aws-lambda/index.mdx b/src/platforms/node/guides/aws-lambda/index.mdx index 8d1eb9709846c..1b0c50e8b1906 100644 --- a/src/platforms/node/guides/aws-lambda/index.mdx +++ b/src/platforms/node/guides/aws-lambda/index.mdx @@ -81,7 +81,7 @@ exports.handler = Sentry.AWSLambda.wrapHandler(yourHandler, { ``` -## Capture all errors when `Promise.allSettled` is returned by the handler +## `Promise.allSettled` Returned by the Handler _(New in version ??)_ By default, sentry capture the error raised by your handler. From e2c0e15eeb21ec233b55332eb669f45bb3398ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Fornarino?= <54641813+J4YF7O@users.noreply.github.com> Date: Tue, 9 Nov 2021 16:37:52 +0100 Subject: [PATCH 03/11] Update src/platforms/node/guides/aws-lambda/index.mdx Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> --- src/platforms/node/guides/aws-lambda/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/node/guides/aws-lambda/index.mdx b/src/platforms/node/guides/aws-lambda/index.mdx index 1b0c50e8b1906..6e3a981c83d24 100644 --- a/src/platforms/node/guides/aws-lambda/index.mdx +++ b/src/platforms/node/guides/aws-lambda/index.mdx @@ -88,7 +88,7 @@ By default, sentry capture the error raised by your handler. It's possible that your handler returns a `Promise.allSettled` result. In this case even if one of the messages has failed, no exception will be captured by Sentry. -The `captureAllSettledReasons` (default: `false`) option capture all promise rejected results. +The `captureAllSettledReasons` (default: `false`) option captures all promise rejected results: ```javascript {tabTitle:promiseSettledDefault} exports.handler = Sentry.AWSLambda.wrapHandler(() => { From 5f34b64b542bcb7c0e38c346dc65546790e8d026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Fornarino?= <54641813+J4YF7O@users.noreply.github.com> Date: Tue, 9 Nov 2021 16:37:57 +0100 Subject: [PATCH 04/11] Update src/platforms/node/guides/aws-lambda/index.mdx Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> --- src/platforms/node/guides/aws-lambda/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/node/guides/aws-lambda/index.mdx b/src/platforms/node/guides/aws-lambda/index.mdx index 6e3a981c83d24..9afa77ced492d 100644 --- a/src/platforms/node/guides/aws-lambda/index.mdx +++ b/src/platforms/node/guides/aws-lambda/index.mdx @@ -85,7 +85,7 @@ exports.handler = Sentry.AWSLambda.wrapHandler(yourHandler, { _(New in version ??)_ By default, sentry capture the error raised by your handler. -It's possible that your handler returns a `Promise.allSettled` result. +However, your handler might return a `Promise.allSettled` result. In this case even if one of the messages has failed, no exception will be captured by Sentry. The `captureAllSettledReasons` (default: `false`) option captures all promise rejected results: From 577a635bc515613d36beaed40f468ca3d6968830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Fornarino?= <54641813+J4YF7O@users.noreply.github.com> Date: Tue, 9 Nov 2021 16:38:01 +0100 Subject: [PATCH 05/11] Update src/platforms/node/guides/aws-lambda/index.mdx Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> --- src/platforms/node/guides/aws-lambda/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/node/guides/aws-lambda/index.mdx b/src/platforms/node/guides/aws-lambda/index.mdx index 9afa77ced492d..f25a7e3dda249 100644 --- a/src/platforms/node/guides/aws-lambda/index.mdx +++ b/src/platforms/node/guides/aws-lambda/index.mdx @@ -86,7 +86,7 @@ _(New in version ??)_ By default, sentry capture the error raised by your handler. However, your handler might return a `Promise.allSettled` result. -In this case even if one of the messages has failed, no exception will be captured by Sentry. +In this case, even if one of the messages has failed, Sentry won't capture any exception. The `captureAllSettledReasons` (default: `false`) option captures all promise rejected results: From 1ede9b1eb76bb2e0b4025ba9a987ce2c4807f1f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Fornarino?= <54641813+J4YF7O@users.noreply.github.com> Date: Tue, 9 Nov 2021 16:38:09 +0100 Subject: [PATCH 06/11] Update src/platforms/node/guides/aws-lambda/index.mdx Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> --- src/platforms/node/guides/aws-lambda/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/node/guides/aws-lambda/index.mdx b/src/platforms/node/guides/aws-lambda/index.mdx index f25a7e3dda249..031eb8c605646 100644 --- a/src/platforms/node/guides/aws-lambda/index.mdx +++ b/src/platforms/node/guides/aws-lambda/index.mdx @@ -84,7 +84,7 @@ exports.handler = Sentry.AWSLambda.wrapHandler(yourHandler, { ## `Promise.allSettled` Returned by the Handler _(New in version ??)_ -By default, sentry capture the error raised by your handler. +By default, Sentry captures errors raised by your handler. However, your handler might return a `Promise.allSettled` result. In this case, even if one of the messages has failed, Sentry won't capture any exception. From 93c2d04ce411a236f9e939872f9eff0ba832d6de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Fornarino?= <54641813+J4YF7O@users.noreply.github.com> Date: Wed, 10 Nov 2021 17:43:12 +0100 Subject: [PATCH 07/11] Update src/platforms/node/guides/aws-lambda/index.mdx Co-authored-by: iker barriocanal <32816711+iker-barriocanal@users.noreply.github.com> --- src/platforms/node/guides/aws-lambda/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/node/guides/aws-lambda/index.mdx b/src/platforms/node/guides/aws-lambda/index.mdx index 031eb8c605646..cdb55a77a0bc8 100644 --- a/src/platforms/node/guides/aws-lambda/index.mdx +++ b/src/platforms/node/guides/aws-lambda/index.mdx @@ -106,7 +106,7 @@ exports.handler = Sentry.AWSLambda.wrapHandler(() => { Promise.rejected(new Error('first')), Promise.rejected(new Error('second')) ]); -}, {captureAllSettledReasons: true}); +}, { captureAllSettledReasons: true }); // `first` and `second` errors are captured ``` From c492dd62c735c7181eba1f41b090ab5cf9d32150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Fornarino?= <54641813+J4YF7O@users.noreply.github.com> Date: Wed, 10 Nov 2021 17:43:16 +0100 Subject: [PATCH 08/11] Update src/platforms/node/guides/aws-lambda/index.mdx Co-authored-by: iker barriocanal <32816711+iker-barriocanal@users.noreply.github.com> --- src/platforms/node/guides/aws-lambda/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/node/guides/aws-lambda/index.mdx b/src/platforms/node/guides/aws-lambda/index.mdx index cdb55a77a0bc8..6b3b1233bc6e2 100644 --- a/src/platforms/node/guides/aws-lambda/index.mdx +++ b/src/platforms/node/guides/aws-lambda/index.mdx @@ -104,7 +104,7 @@ exports.handler = Sentry.AWSLambda.wrapHandler(() => { exports.handler = Sentry.AWSLambda.wrapHandler(() => { return Promise.allSettled([ Promise.rejected(new Error('first')), - Promise.rejected(new Error('second')) + Promise.rejected(new Error('second')), ]); }, { captureAllSettledReasons: true }); // `first` and `second` errors are captured From 213ad221db15762b76fc9d56c76c793c81715217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Fornarino?= <54641813+J4YF7O@users.noreply.github.com> Date: Wed, 10 Nov 2021 17:43:29 +0100 Subject: [PATCH 09/11] Update src/platforms/node/guides/aws-lambda/index.mdx Co-authored-by: iker barriocanal <32816711+iker-barriocanal@users.noreply.github.com> --- src/platforms/node/guides/aws-lambda/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/node/guides/aws-lambda/index.mdx b/src/platforms/node/guides/aws-lambda/index.mdx index 6b3b1233bc6e2..a89d84c1fabd8 100644 --- a/src/platforms/node/guides/aws-lambda/index.mdx +++ b/src/platforms/node/guides/aws-lambda/index.mdx @@ -81,7 +81,7 @@ exports.handler = Sentry.AWSLambda.wrapHandler(yourHandler, { ``` -## `Promise.allSettled` Returned by the Handler +## Capture Rejected Promises in `Promise.allSettled` _(New in version ??)_ By default, Sentry captures errors raised by your handler. From 1e66df569ab338fe0603e3afa249e5d36eeb2e71 Mon Sep 17 00:00:00 2001 From: J4YM Date: Wed, 10 Nov 2021 18:34:05 +0100 Subject: [PATCH 10/11] remove exemple --- src/platforms/node/guides/aws-lambda/index.mdx | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/platforms/node/guides/aws-lambda/index.mdx b/src/platforms/node/guides/aws-lambda/index.mdx index a89d84c1fabd8..e30b4020146da 100644 --- a/src/platforms/node/guides/aws-lambda/index.mdx +++ b/src/platforms/node/guides/aws-lambda/index.mdx @@ -88,17 +88,7 @@ By default, Sentry captures errors raised by your handler. However, your handler might return a `Promise.allSettled` result. In this case, even if one of the messages has failed, Sentry won't capture any exception. -The `captureAllSettledReasons` (default: `false`) option captures all promise rejected results: - -```javascript {tabTitle:promiseSettledDefault} -exports.handler = Sentry.AWSLambda.wrapHandler(() => { - return Promise.allSettled([ - Promise.rejected(new Error('first')), - Promise.rejected(new Error('second')) - ]); -}); -// Nothing captured -``` +The `captureAllSettledReasons` (default: `false`) option captures all promise rejected results ```javascript {tabTitle:captureAllSettledReasons} exports.handler = Sentry.AWSLambda.wrapHandler(() => { From f8f45f5eed7bb86d5fd1880ea07b8969f10cdf7f Mon Sep 17 00:00:00 2001 From: J4YM Date: Fri, 12 Nov 2021 10:47:21 +0100 Subject: [PATCH 11/11] set `new in version` https://github.com/getsentry/sentry-docs/pull/4374#pullrequestreview-803788209 --- src/platforms/node/guides/aws-lambda/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/node/guides/aws-lambda/index.mdx b/src/platforms/node/guides/aws-lambda/index.mdx index e30b4020146da..d3076e1e77784 100644 --- a/src/platforms/node/guides/aws-lambda/index.mdx +++ b/src/platforms/node/guides/aws-lambda/index.mdx @@ -82,7 +82,7 @@ exports.handler = Sentry.AWSLambda.wrapHandler(yourHandler, { ## Capture Rejected Promises in `Promise.allSettled` -_(New in version ??)_ +_(New in version 6.14.3)_ By default, Sentry captures errors raised by your handler. However, your handler might return a `Promise.allSettled` result.