sdk-javascript icon indicating copy to clipboard operation
sdk-javascript copied to clipboard

fix: handle big integers in incoming events

Open lance opened this issue 3 years ago • 2 comments

An event may have data that contains a BigInt. The builtin JSON parser for JavaScript does not handle the BigInt types. The introduced json-bigint dependency (34k) does.

Fixes: https://github.com/cloudevents/sdk-javascript/issues/489

Signed-off-by: Lance Ball [email protected]

lance avatar Jun 14 '22 20:06 lance

Closing and reopening to trigger re-run of CI with updated package.json (to hopefully fix errors)

lance avatar Jun 14 '22 21:06 lance

This pull request is stale because it has been open 30 days with no activity.

github-actions[bot] avatar Jul 16 '22 00:07 github-actions[bot]

@cardil I have added an environment variable to enable the json-bigint module. I'm not a huge fan of this approach because the check is made for each call to the parser. The library does not have an obvious place to set flags or other static values. An alternative approach would be to add this as an option to the HTTP.toEvent() method, but that changes the method signature resulting in a lot of small changes all over the codebase.

@lholmquist ptal

lance avatar May 08 '23 20:05 lance