inngest / inngest-js

The developer platform for easily building reliable workflows with zero infrastructure for TypeScript & JavaScript
https://www.inngest.com/
GNU General Public License v3.0
414 stars 41 forks source link

Fix `stringify()` failing to serialize `BigInt`; remove instead #375

Closed jpwilliams closed 11 months ago

jpwilliams commented 11 months ago

Summary

BigInts are not natively parsed by JSON. Attempting to return a BigInt from a step or function will throw an error. This error was hard to see, which is fixed in #374.

Our types reflect that BigInt is unparseable and will type it as never, though these were obscured from the user a touch, which is fixed in #371.

For this reason, this PR ensures BigInts are removed during parsing instead of throwing. We can investigate adding BigInt support across our SDKs past this fix; the n suffix seems an unwritten standard.

Checklist

Related

changeset-bot[bot] commented 11 months ago

🦋 Changeset detected

Latest commit: 450b5612f417e97b6b0cfc5bc9f3102b4dde015b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------- | ----- | | inngest | Patch |

Not sure what this means? Click here to learn what changesets are.

[Click here if you're a maintainer who wants to add another changeset to this PR](https://github.com/inngest/inngest-js/new/fix/strip-bigint?filename=.changeset/moody-beans-teach.md&value=---%0A%22inngest%22%3A%20patch%0A---%0A%0AFix%20%60stringify()%60%20failing%20to%20serialize%20%60BigInt%60%3B%20remove%20instead%0A)

jpwilliams commented 11 months ago

Add to tests:

https://github.com/inngest/inngest-js/blob/4c71b9a699529772bc787b7085f964aab67e6f78/packages/inngest/src/components/InngestStepTools.test.ts#L179-L221