serverless-spy 0.0.60 → 0.0.62

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.
Files changed (101) hide show
  1. package/.jsii +4 -3
  2. package/README.md +1 -1
  3. package/_config.yml +14 -3
  4. package/assets/images/site-logo.png +0 -0
  5. package/dist/releasetag.txt +1 -1
  6. package/doc/Lambda.md +2 -0
  7. package/extension/interceptor.ts +5 -1
  8. package/lib/extension/dist/layer/nodejs/node_modules/interceptor.js +147 -2
  9. package/lib/extension/dist/layer/nodejs/node_modules/interceptor.js.map +4 -4
  10. package/lib/src/ServerlessSpy.js +1 -1
  11. package/logo/full_logo.png +0 -0
  12. package/node_modules/serialize-error/error-constructors.d.ts +8 -0
  13. package/node_modules/serialize-error/error-constructors.js +26 -0
  14. package/node_modules/serialize-error/index.d.ts +171 -0
  15. package/node_modules/serialize-error/index.js +205 -0
  16. package/node_modules/serialize-error/license +9 -0
  17. package/node_modules/serialize-error/node_modules/type-fest/index.d.ts +95 -0
  18. package/node_modules/serialize-error/node_modules/type-fest/package.json +52 -0
  19. package/node_modules/serialize-error/node_modules/type-fest/readme.md +905 -0
  20. package/node_modules/serialize-error/node_modules/type-fest/source/async-return-type.d.ts +25 -0
  21. package/node_modules/serialize-error/node_modules/type-fest/source/asyncify.d.ts +33 -0
  22. package/node_modules/serialize-error/node_modules/type-fest/source/basic.d.ts +45 -0
  23. package/node_modules/serialize-error/node_modules/type-fest/source/camel-case.d.ts +73 -0
  24. package/node_modules/serialize-error/node_modules/type-fest/source/camel-cased-properties-deep.d.ts +54 -0
  25. package/node_modules/serialize-error/node_modules/type-fest/source/camel-cased-properties.d.ts +36 -0
  26. package/node_modules/serialize-error/node_modules/type-fest/source/conditional-except.d.ts +45 -0
  27. package/node_modules/serialize-error/node_modules/type-fest/source/conditional-keys.d.ts +47 -0
  28. package/node_modules/serialize-error/node_modules/type-fest/source/conditional-pick.d.ts +44 -0
  29. package/node_modules/serialize-error/node_modules/type-fest/source/delimiter-case.d.ts +93 -0
  30. package/node_modules/serialize-error/node_modules/type-fest/source/delimiter-cased-properties-deep.d.ts +60 -0
  31. package/node_modules/serialize-error/node_modules/type-fest/source/delimiter-cased-properties.d.ts +37 -0
  32. package/node_modules/serialize-error/node_modules/type-fest/source/entries.d.ts +62 -0
  33. package/node_modules/serialize-error/node_modules/type-fest/source/entry.d.ts +65 -0
  34. package/node_modules/serialize-error/node_modules/type-fest/source/exact.d.ts +73 -0
  35. package/node_modules/serialize-error/node_modules/type-fest/source/except.d.ts +57 -0
  36. package/node_modules/serialize-error/node_modules/type-fest/source/fixed-length-array.d.ts +43 -0
  37. package/node_modules/serialize-error/node_modules/type-fest/source/get.d.ts +184 -0
  38. package/node_modules/serialize-error/node_modules/type-fest/source/has-optional-keys.d.ts +21 -0
  39. package/node_modules/serialize-error/node_modules/type-fest/source/has-required-keys.d.ts +59 -0
  40. package/node_modules/serialize-error/node_modules/type-fest/source/includes.d.ts +22 -0
  41. package/node_modules/serialize-error/node_modules/type-fest/source/internal.d.ts +59 -0
  42. package/node_modules/serialize-error/node_modules/type-fest/source/invariant-of.d.ts +76 -0
  43. package/node_modules/serialize-error/node_modules/type-fest/source/iterable-element.d.ts +54 -0
  44. package/node_modules/serialize-error/node_modules/type-fest/source/join.d.ts +30 -0
  45. package/node_modules/serialize-error/node_modules/type-fest/source/jsonify.d.ts +90 -0
  46. package/node_modules/serialize-error/node_modules/type-fest/source/kebab-case.d.ts +38 -0
  47. package/node_modules/serialize-error/node_modules/type-fest/source/kebab-cased-properties-deep.d.ts +47 -0
  48. package/node_modules/serialize-error/node_modules/type-fest/source/kebab-cased-properties.d.ts +30 -0
  49. package/node_modules/serialize-error/node_modules/type-fest/source/last-array-element.d.ts +28 -0
  50. package/node_modules/serialize-error/node_modules/type-fest/source/literal-to-primitive.d.ts +36 -0
  51. package/node_modules/serialize-error/node_modules/type-fest/source/literal-union.d.ts +35 -0
  52. package/node_modules/serialize-error/node_modules/type-fest/source/merge-exclusive.d.ts +41 -0
  53. package/node_modules/serialize-error/node_modules/type-fest/source/merge.d.ts +27 -0
  54. package/node_modules/serialize-error/node_modules/type-fest/source/multidimensional-array.d.ts +43 -0
  55. package/node_modules/serialize-error/node_modules/type-fest/source/multidimensional-readonly-array.d.ts +47 -0
  56. package/node_modules/serialize-error/node_modules/type-fest/source/mutable.d.ts +5 -0
  57. package/node_modules/serialize-error/node_modules/type-fest/source/numeric.d.ts +170 -0
  58. package/node_modules/serialize-error/node_modules/type-fest/source/observable-like.d.ts +62 -0
  59. package/node_modules/serialize-error/node_modules/type-fest/source/opaque.d.ts +107 -0
  60. package/node_modules/serialize-error/node_modules/type-fest/source/optional-keys-of.d.ts +38 -0
  61. package/node_modules/serialize-error/node_modules/type-fest/source/package-json.d.ts +663 -0
  62. package/node_modules/serialize-error/node_modules/type-fest/source/partial-deep.d.ts +113 -0
  63. package/node_modules/serialize-error/node_modules/type-fest/source/partial-on-undefined-deep.d.ts +70 -0
  64. package/node_modules/serialize-error/node_modules/type-fest/source/pascal-case.d.ts +38 -0
  65. package/node_modules/serialize-error/node_modules/type-fest/source/pascal-cased-properties-deep.d.ts +54 -0
  66. package/node_modules/serialize-error/node_modules/type-fest/source/pascal-cased-properties.d.ts +34 -0
  67. package/node_modules/serialize-error/node_modules/type-fest/source/primitive.d.ts +13 -0
  68. package/node_modules/serialize-error/node_modules/type-fest/source/promisable.d.ts +25 -0
  69. package/node_modules/serialize-error/node_modules/type-fest/source/promise-value.d.ts +29 -0
  70. package/node_modules/serialize-error/node_modules/type-fest/source/readonly-deep.d.ts +85 -0
  71. package/node_modules/serialize-error/node_modules/type-fest/source/readonly-tuple.d.ts +41 -0
  72. package/node_modules/serialize-error/node_modules/type-fest/source/remove-index-signature.d.ts +104 -0
  73. package/node_modules/serialize-error/node_modules/type-fest/source/replace.d.ts +67 -0
  74. package/node_modules/serialize-error/node_modules/type-fest/source/require-all-or-none.d.ts +36 -0
  75. package/node_modules/serialize-error/node_modules/type-fest/source/require-at-least-one.d.ts +35 -0
  76. package/node_modules/serialize-error/node_modules/type-fest/source/require-exactly-one.d.ts +34 -0
  77. package/node_modules/serialize-error/node_modules/type-fest/source/required-keys-of.d.ts +29 -0
  78. package/node_modules/serialize-error/node_modules/type-fest/source/schema.d.ts +72 -0
  79. package/node_modules/serialize-error/node_modules/type-fest/source/screaming-snake-case.d.ts +33 -0
  80. package/node_modules/serialize-error/node_modules/type-fest/source/set-non-nullable.d.ts +35 -0
  81. package/node_modules/serialize-error/node_modules/type-fest/source/set-optional.d.ts +35 -0
  82. package/node_modules/serialize-error/node_modules/type-fest/source/set-required.d.ts +35 -0
  83. package/node_modules/serialize-error/node_modules/type-fest/source/set-return-type.d.ts +31 -0
  84. package/node_modules/serialize-error/node_modules/type-fest/source/simplify.d.ts +83 -0
  85. package/node_modules/serialize-error/node_modules/type-fest/source/snake-case.d.ts +38 -0
  86. package/node_modules/serialize-error/node_modules/type-fest/source/snake-cased-properties-deep.d.ts +47 -0
  87. package/node_modules/serialize-error/node_modules/type-fest/source/snake-cased-properties.d.ts +30 -0
  88. package/node_modules/serialize-error/node_modules/type-fest/source/split.d.ts +29 -0
  89. package/node_modules/serialize-error/node_modules/type-fest/source/spread.d.ts +85 -0
  90. package/node_modules/serialize-error/node_modules/type-fest/source/string-key-of.d.ts +25 -0
  91. package/node_modules/serialize-error/node_modules/type-fest/source/stringified.d.ts +23 -0
  92. package/node_modules/serialize-error/node_modules/type-fest/source/trim.d.ts +25 -0
  93. package/node_modules/serialize-error/node_modules/type-fest/source/tsconfig-json.d.ts +1172 -0
  94. package/node_modules/serialize-error/node_modules/type-fest/source/typed-array.d.ts +17 -0
  95. package/node_modules/serialize-error/node_modules/type-fest/source/union-to-intersection.d.ts +60 -0
  96. package/node_modules/serialize-error/node_modules/type-fest/source/value-of.d.ts +42 -0
  97. package/node_modules/serialize-error/node_modules/type-fest/source/writable.d.ts +40 -0
  98. package/node_modules/serialize-error/package.json +46 -0
  99. package/node_modules/serialize-error/readme.md +198 -0
  100. package/package.json +6 -4
  101. package/doc/sample_app.md +0 -0
package/.jsii CHANGED
@@ -29,6 +29,7 @@
29
29
  "caporal": "^1.4.0",
30
30
  "json-format-highlight": "^1.0.4",
31
31
  "open": "^8.4.0",
32
+ "serialize-error": "^11.0.0",
32
33
  "ws": "^8.9.0"
33
34
  },
34
35
  "dependencies": {
@@ -3177,7 +3178,7 @@
3177
3178
  },
3178
3179
  "name": "serverless-spy",
3179
3180
  "readme": {
3180
- "markdown": "![ServerlessSpy](./logo/full_logo.svg)\n\nCDK-based library for writing elegant, fast-executing integration tests on AWS serverless architecture and an additional web console to monitor events in real time.\n\n# How it works\n\n**ServerlessSpy CDK construct creates infrastructure to intercept events in Lambda, SNS, SQS, EventBridge, DynamoDB, S3... and sends it to a testing library or your local web console via API Gateway WebSocket. The testing library subscribes to events so tests can be executed fast without checking/retrying if the process has finished. The testing library is integrated with Jest but can also be used with any other testing library. The web console can be used to see and inspect events in real time.**\n\n[![Concept](./doc/concept.svg)](https://serverlessspy.com/)\n\n**Your test for the example above would look something like this:**\n```typescript\n(\n await serverlessSpyListener.waitForEventBridgeMyEventBus<TestData>({\n condition: (d) => d.detail.id === id,\n })\n).toMatchObject(...);\n\n(\n await serverlessSpyListener.waitForSnsTopicMyTopic<TestData>({\n condition: (d) => d.message.id === id,\n })\n).toMatchObject(...);\n\n(\n await serverlessSpyListener.waitForSqsMyQueue<TestData>({\n condition: (d) => d.body.id === id,\n })\n).toMatchObject(...);\n\n(\n await (\n await serverlessSpyListener.waitForFunctionMyLambdaRequest<TestData>({\n condition: (d) => d.request.id === id,\n })\n ).followedByResponse();\n).toMatchObject(...);\n\n(\n await serverlessSpyListener.waitForDynamoDBMyTable<TestData>({\n condition: (d) => d.keys.pk === id,\n })\n).toMatchObject({\n eventName: 'INSERT',\n newImage: ...,\n});\n```\n\n**You can see all the events in the local web console:**\n![Web console](./doc/web_console.gif)\n\n# Key benefits\n - **Easy** to write tests that are strongly typed thanks to TypeScript ❤️.\n - **Tests are executed much FASTER** 🏎️💨 No need to write tests in a way to periodically check if the process has finished because all events are pushed to the testing library.\n - **Tests can run in parallel** if you use conditions and filter events specific to your test. This drastically reduces the execution time of the CI/CD process.\n - **Web console** enables you to see all events in real time. Debugging 🕵 has never been easier. Search is supported (with regular expression).\n\n# What ServerlessSpy is not\n - ServerlessSpy can not be used if your infrastructure is not created with CDK.\n - The solution is meant only for the development and (automatic) testing environment. You should **EXCLUDE** ServerlessSpy CDK construct in any other environment, especially a production or a high-load environment. ServerlessSpy is not meant for those; it just induces costs and could contribute to hitting AWS quotas (Lambda concurrent executions, ...).\n - Only Node.js stack is supported. There are no plans to support Python or any other. Use of TypeScript is deeply encouraged.\n - Web console only runs on your local computer. No cloud hosting of any kind (for now).\n\n# Documentation\n - [Quick Start](doc/quick_start.md)\n - [CDK Construct](doc/CDK_construct.md)\n - [Writing tests](doc/writing_tests.md)\n - [Lambda](doc/Lambda.md)\n - [SQS](doc/SQS.md)\n - [SNS](doc/SNS.md)\n - [EventBridge](doc/EventBridge.md)\n - [DynamoDB](doc/DynamoDB.md)\n - [S3](doc/S3.md)\n - Kinesis (work in progress)\n - Step Functions (work in progress)\n - [Web Console](doc/web_console.md)\n - [Frequently Asked Questions (FAQ)](doc/FAQ.md)\n - [Sample Application](doc/sample_app.md)\n - [Roadmap](doc/roadmap.md)\n - [Code of Conduct](doc/CODE_OF_CONDUCT.md)\n - [Contributing Guide](doc/CONTRIBUTING.md)\n - [Contributors](doc/Contributors.md)\n - [License](./LICENSE.md)"
3181
+ "markdown": "![ServerlessSpy](./logo/full_logo.svg)\n\nCDK-based library for writing elegant, fast-executing integration tests on AWS serverless architecture and an additional web console to monitor events in real time.\n\n# How it works\n\n**ServerlessSpy CDK construct creates infrastructure to intercept events in Lambda, SNS, SQS, EventBridge, DynamoDB, S3... and sends it to a testing library or your local web console via API Gateway WebSocket. The testing library subscribes to events so tests can be executed fast without checking/retrying if the process has finished. The testing library is integrated with Jest but can also be used with any other testing library. The web console can be used to see and inspect events in real time.**\n\n[![Concept](./doc/concept.svg)](https://serverlessspy.com/)\n\n**Your test for the example above would look something like this:**\n```typescript\n(\n await serverlessSpyListener.waitForEventBridgeMyEventBus<TestData>({\n condition: (d) => d.detail.id === id,\n })\n).toMatchObject(...);\n\n(\n await serverlessSpyListener.waitForSnsTopicMyTopic<TestData>({\n condition: (d) => d.message.id === id,\n })\n).toMatchObject(...);\n\n(\n await serverlessSpyListener.waitForSqsMyQueue<TestData>({\n condition: (d) => d.body.id === id,\n })\n).toMatchObject(...);\n\n(\n await (\n await serverlessSpyListener.waitForFunctionMyLambdaRequest<TestData>({\n condition: (d) => d.request.id === id,\n })\n ).followedByResponse();\n).toMatchObject(...);\n\n(\n await serverlessSpyListener.waitForDynamoDBMyTable<TestData>({\n condition: (d) => d.keys.pk === id,\n })\n).toMatchObject({\n eventName: 'INSERT',\n newImage: ...,\n});\n```\n\n**You can see all the events in the local web console:**\n![Web console](./doc/web_console.gif)\n\n# Key benefits\n - **Easy** to write tests that are strongly typed thanks to TypeScript ❤️.\n - **Tests are executed much FASTER** 🏎️💨 No need to write tests in a way to periodically check if the process has finished because all events are pushed to the testing library.\n - **Tests can run in parallel** if you use conditions and filter events specific to your test. This drastically reduces the execution time of the CI/CD process.\n - **Web console** enables you to see all events in real time. Debugging 🕵 has never been easier. Search is supported (with regular expression).\n\n# What ServerlessSpy is not\n - ServerlessSpy can not be used if your infrastructure is not created with CDK.\n - The solution is meant only for the development and (automatic) testing environment. You should **EXCLUDE** ServerlessSpy CDK construct in any other environment, especially a production or a high-load environment. ServerlessSpy is not meant for those; it just induces costs and could contribute to hitting AWS quotas (Lambda concurrent executions, ...).\n - Only Node.js stack is supported. There are no plans to support Python or any other. Use of TypeScript is deeply encouraged.\n - Web console only runs on your local computer. No cloud hosting of any kind (for now).\n\n# Documentation\n - [Quick Start](doc/quick_start.md)\n - [CDK Construct](doc/CDK_construct.md)\n - [Writing tests](doc/writing_tests.md)\n - [Lambda](doc/Lambda.md)\n - [SQS](doc/SQS.md)\n - [SNS](doc/SNS.md)\n - [EventBridge](doc/EventBridge.md)\n - [DynamoDB](doc/DynamoDB.md)\n - [S3](doc/S3.md)\n - Kinesis (work in progress)\n - Step Functions (work in progress)\n - [Web Console](doc/web_console.md)\n - [Frequently Asked Questions (FAQ)](doc/FAQ.md)\n - [Sample Application](https://github.com/ServerlessLife/serverless-spy-example){:target=\"_blank\"}\n - [Roadmap](doc/roadmap.md)\n - [Code of Conduct](doc/CODE_OF_CONDUCT.md)\n - [Contributing Guide](doc/CONTRIBUTING.md)\n - [Contributors](doc/Contributors.md)\n - [License](./LICENSE.md)"
3181
3182
  },
3182
3183
  "repository": {
3183
3184
  "type": "git",
@@ -3554,6 +3555,6 @@
3554
3555
  "symbolId": "src/ServerlessSpy:SpyFilter"
3555
3556
  }
3556
3557
  },
3557
- "version": "0.0.60",
3558
- "fingerprint": "FcEWAH5c5WmM5F9T30IOvIWRsuriEgZRBpQhyTI+NDg="
3558
+ "version": "0.0.62",
3559
+ "fingerprint": "ch9R369njclSIl5fVQ2DpKGxZ9r/81SAEQPXC0yrNPo="
3559
3560
  }
package/README.md CHANGED
@@ -75,7 +75,7 @@ CDK-based library for writing elegant, fast-executing integration tests on AWS s
75
75
  - Step Functions (work in progress)
76
76
  - [Web Console](doc/web_console.md)
77
77
  - [Frequently Asked Questions (FAQ)](doc/FAQ.md)
78
- - [Sample Application](doc/sample_app.md)
78
+ - [Sample Application](https://github.com/ServerlessLife/serverless-spy-example){:target="_blank"}
79
79
  - [Roadmap](doc/roadmap.md)
80
80
  - [Code of Conduct](doc/CODE_OF_CONDUCT.md)
81
81
  - [Contributing Guide](doc/CONTRIBUTING.md)
package/_config.yml CHANGED
@@ -3,8 +3,11 @@ project: 'ServerlessSpy'
3
3
  description: 'CDK-based library for writing elegant integration tests on AWS serverless architecture and an additional web console to monitor events in real time.'
4
4
  author: Marko (ServerlessLife)
5
5
  email: marko@serverlesslife.com
6
- image: logo/full_logo.png
6
+ image: https://serverlessspy.com/logo/full_logo.svg
7
7
  twitter_username: ServerlessL
8
+ twitter:
9
+ username: ServerlessL
10
+ og_image: https://serverlessspy.com/logo/full_logo.svg
8
11
  github_username: serverlesslife
9
12
  show_downloads: false
10
13
  encoding: UTF-8
@@ -17,8 +20,8 @@ jailed: false
17
20
  gfm_quirks: paragraph_end
18
21
  theme: minimal-mistakes-jekyll
19
22
  minimal_mistakes_skin: dark
20
- teaser: /logo/full_logo.svg
21
- logo: /logo/full_logo.svg
23
+ teaser: https://serverlessspy.com/logo/full_logo.svg
24
+ logo: https://serverlessspy.com/logo/full_logo.svg
22
25
  markdown: kramdown
23
26
  sass:
24
27
  # Where you keep your scss files
@@ -40,3 +43,11 @@ analytics:
40
43
  provider: 'google-gtag'
41
44
  google:
42
45
  tracking_id: 'G-C2PHH6WYPP'
46
+ social:
47
+ links:
48
+ - 'https://twitter.com/ServerlessL'
49
+ - 'https://www.linkedin.com/in/marko-serverlesslife/'
50
+ author:
51
+ name : Marko (ServerlessLife)
52
+ avatar : "/logo/marko_serverlesslife.jpg"
53
+ bio : "Full-stack Software Developer | AWS Certified Professional | Serverless Specialist"
Binary file
@@ -1 +1 @@
1
- v0.0.60
1
+ v0.0.62
package/doc/Lambda.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Lambda
2
2
 
3
+ Under the cover, ServerlessSpy intercepts Lambda events with [Lambda internal extension](https://lumigo.io/blog/aws-lambda-extensions-what-are-they-and-why-do-they-matter/).
4
+
3
5
  Basic example:
4
6
 
5
7
  ```typescript
@@ -7,6 +7,7 @@ import { FunctionResponseSpyEvent } from '../common/spyEvents/FunctionResponseSp
7
7
  import { SpyEventSender } from '../common/SpyEventSender';
8
8
  import { envVariableNames } from '../src/common/envVariableNames';
9
9
  import { load } from './aws/UserFunction';
10
+ import { serializeError } from 'serialize-error';
10
11
 
11
12
  const ORIGINAL_HANDLER_KEY = 'ORIGINAL_HANDLER';
12
13
 
@@ -73,12 +74,15 @@ export const handler = (
73
74
 
74
75
  const fail = (error: any) => {
75
76
  logError(error);
77
+
78
+ const errorSerialized = serializeError(error);
79
+
76
80
  const key = `Function#${
77
81
  process.env[envVariableNames.SSPY_FUNCTION_NAME]
78
82
  }#Error`;
79
83
  const p = sendLambdaSpyEvent(key, <FunctionErrorSpyEvent>{
80
84
  request: event,
81
- error,
85
+ error: errorSerialized,
82
86
  context: contextSpy,
83
87
  });
84
88
  promises.push(p);
@@ -26199,7 +26199,7 @@ var require_convertToNative = __commonJS({
26199
26199
  };
26200
26200
  var convertString = (stringValue) => stringValue;
26201
26201
  var convertBinary = (binaryValue) => binaryValue;
26202
- var convertList = (list, options) => list.map((item) => (0, exports.convertToNative)(item, options));
26202
+ var convertList = (list2, options) => list2.map((item) => (0, exports.convertToNative)(item, options));
26203
26203
  var convertMap = (map, options) => Object.entries(map).reduce((acc, [key, value]) => ({
26204
26204
  ...acc,
26205
26205
  [key]: (0, exports.convertToNative)(value, options)
@@ -26605,6 +26605,150 @@ var load = function(appRoot, fullHandlerString) {
26605
26605
  return handlerFunc;
26606
26606
  };
26607
26607
 
26608
+ // node_modules/serialize-error/error-constructors.js
26609
+ var list = [
26610
+ EvalError,
26611
+ RangeError,
26612
+ ReferenceError,
26613
+ SyntaxError,
26614
+ TypeError,
26615
+ URIError,
26616
+ globalThis.DOMException,
26617
+ globalThis.AssertionError,
26618
+ globalThis.SystemError
26619
+ ].filter(Boolean).map(
26620
+ (constructor) => [constructor.name, constructor]
26621
+ );
26622
+ var errorConstructors = new Map(list);
26623
+ var error_constructors_default = errorConstructors;
26624
+
26625
+ // node_modules/serialize-error/index.js
26626
+ var commonProperties = [
26627
+ {
26628
+ property: "name",
26629
+ enumerable: false
26630
+ },
26631
+ {
26632
+ property: "message",
26633
+ enumerable: false
26634
+ },
26635
+ {
26636
+ property: "stack",
26637
+ enumerable: false
26638
+ },
26639
+ {
26640
+ property: "code",
26641
+ enumerable: true
26642
+ },
26643
+ {
26644
+ property: "cause",
26645
+ enumerable: false
26646
+ }
26647
+ ];
26648
+ var toJsonWasCalled = Symbol(".toJSON was called");
26649
+ var toJSON = (from) => {
26650
+ from[toJsonWasCalled] = true;
26651
+ const json = from.toJSON();
26652
+ delete from[toJsonWasCalled];
26653
+ return json;
26654
+ };
26655
+ var getErrorConstructor = (name) => error_constructors_default.get(name) ?? Error;
26656
+ var destroyCircular = ({
26657
+ from,
26658
+ seen,
26659
+ to,
26660
+ forceEnumerable,
26661
+ maxDepth,
26662
+ depth,
26663
+ useToJSON,
26664
+ serialize
26665
+ }) => {
26666
+ if (!to) {
26667
+ if (Array.isArray(from)) {
26668
+ to = [];
26669
+ } else if (!serialize && isErrorLike(from)) {
26670
+ const Error2 = getErrorConstructor(from.name);
26671
+ to = new Error2();
26672
+ } else {
26673
+ to = {};
26674
+ }
26675
+ }
26676
+ seen.push(from);
26677
+ if (depth >= maxDepth) {
26678
+ return to;
26679
+ }
26680
+ if (useToJSON && typeof from.toJSON === "function" && from[toJsonWasCalled] !== true) {
26681
+ return toJSON(from);
26682
+ }
26683
+ const continueDestroyCircular = (value) => destroyCircular({
26684
+ from: value,
26685
+ seen: [...seen],
26686
+ forceEnumerable,
26687
+ maxDepth,
26688
+ depth,
26689
+ useToJSON,
26690
+ serialize
26691
+ });
26692
+ for (const [key, value] of Object.entries(from)) {
26693
+ if (typeof Buffer === "function" && Buffer.isBuffer(value)) {
26694
+ to[key] = "[object Buffer]";
26695
+ continue;
26696
+ }
26697
+ if (value !== null && typeof value === "object" && typeof value.pipe === "function") {
26698
+ to[key] = "[object Stream]";
26699
+ continue;
26700
+ }
26701
+ if (typeof value === "function") {
26702
+ continue;
26703
+ }
26704
+ if (!value || typeof value !== "object") {
26705
+ to[key] = value;
26706
+ continue;
26707
+ }
26708
+ if (!seen.includes(from[key])) {
26709
+ depth++;
26710
+ to[key] = continueDestroyCircular(from[key]);
26711
+ continue;
26712
+ }
26713
+ to[key] = "[Circular]";
26714
+ }
26715
+ for (const { property, enumerable } of commonProperties) {
26716
+ if (typeof from[property] !== "undefined" && from[property] !== null) {
26717
+ Object.defineProperty(to, property, {
26718
+ value: isErrorLike(from[property]) ? continueDestroyCircular(from[property]) : from[property],
26719
+ enumerable: forceEnumerable ? true : enumerable,
26720
+ configurable: true,
26721
+ writable: true
26722
+ });
26723
+ }
26724
+ }
26725
+ return to;
26726
+ };
26727
+ function serializeError(value, options = {}) {
26728
+ const {
26729
+ maxDepth = Number.POSITIVE_INFINITY,
26730
+ useToJSON = true
26731
+ } = options;
26732
+ if (typeof value === "object" && value !== null) {
26733
+ return destroyCircular({
26734
+ from: value,
26735
+ seen: [],
26736
+ forceEnumerable: true,
26737
+ maxDepth,
26738
+ depth: 0,
26739
+ useToJSON,
26740
+ serialize: true
26741
+ });
26742
+ }
26743
+ if (typeof value === "function") {
26744
+ return `[Function: ${value.name ?? "anonymous"}]`;
26745
+ }
26746
+ return value;
26747
+ }
26748
+ function isErrorLike(value) {
26749
+ return Boolean(value) && typeof value === "object" && "name" in value && "message" in value && "stack" in value;
26750
+ }
26751
+
26608
26752
  // extension/interceptor.ts
26609
26753
  var ORIGINAL_HANDLER_KEY = "ORIGINAL_HANDLER";
26610
26754
  var subscribedToSQS = process.env["SSPY_SUBSCRIBED_TO_SQS" /* SSPY_SUBSCRIBED_TO_SQS */] === "true";
@@ -26647,10 +26791,11 @@ var handler = (event, context, callback) => {
26647
26791
  const originalHandler = getOriginalHandler();
26648
26792
  const fail = (error) => {
26649
26793
  logError(error);
26794
+ const errorSerialized = serializeError(error);
26650
26795
  const key2 = `Function#${process.env["SSPY_FUNCTION_NAME" /* SSPY_FUNCTION_NAME */]}#Error`;
26651
26796
  const p2 = sendLambdaSpyEvent(key2, {
26652
26797
  request: event,
26653
- error,
26798
+ error: errorSerialized,
26654
26799
  context: contextSpy
26655
26800
  });
26656
26801
  promises.push(p2);