Closed airhorns closed 1 year ago
This issue is stale because it has been open for 90 days with no activity. It will be closed if no further action occurs in 14 days.
We are closing this issue because it has been inactive for a few months. This probably means that it is not reproducible or it has been fixed in a newer version. If it’s an enhancement and hasn’t been taken on since it was submitted, then it seems other issues have taken priority.
If you still encounter this issue with the latest stable version, please reopen using the issue template. You can also contribute directly by submitting a pull request– see the CONTRIBUTING.md file for guidelines
Thank you!
Issue summary
Shopify's REST APIs produce ID numbers in the JSON responses that require more than 53 bits of precision to represent, which when parsed with the plain old
JSON.parse
built in lose precision, resulting in issues like these: https://community.shopify.com/c/Shopify-APIs-SDKs/Int-too-big-to-fit-in-my-API/td-p/1070054As best I can tell, this library uses
JSON.stringify
andJSON.parse
to send and receive JSON vianode-fetch
'sresponse.json()
, which means that the ID numbers sent and returned from various calls will have their precision truncated and be incorrect! I hope I am missing something, but otherwise, I think it would be good for this library to do something to help users properly parse (and send) bigints to/from Shopify.In the past, solutions like
json-bigint
used userland implementations of arbitrary precision numbers likebig.js
, but now, newer ES versions have thebigint
type built in.json-bigint
allows that type to be used natively for parsing and stringifying with theuseNativeBigint
option, so would it make sense to switch to it for all that and ask users to use native bigints to represent big IDs?Expected behavior
Data retrieved via the REST API from a newer shop that happens to have very big IDs should have those IDs captured with full precision when returned to the calling code
Actual behavior
Retrieved objects with very big IDs have the IDs precision truncated and are thus incorrect when returned to calling code
Steps to reproduce the problem
Fetch the
events
resource for a recent shop with some activity on it is the best advice I have for finding resources with high IDsChecklist