-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ipfs-http-client & go-ipfs - BigInt issue with stats.bw() #3782
Comments
Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
Finally, remember to use https://discuss.ipfs.io if you just need general support. |
These values and others are returned by the go-IPFS HTTP API as Using Really we need the go-IPFS HTTP API to return these (and all I've opened ipfs/kubo#8319 to discuss this. |
Thank you for the fast response Alex. Going the string route sounds like a good idea. I was wondering if Looking forward to an update to go-ipfs! |
The return type for `rateIn`/`rateOut` should be a float and not an integer. go-IPFS returns a `float64` which isn't representible in js, but we are not interested in that level of accuracy for this value so just return it as a regular `float`. Fixes #3782
The return type for `rateIn`/`rateOut` should be a number and not an integer. go-IPFS returns a `float64` which isn't representable in js, but we are not interested in that level of accuracy for this value so just return it as a regular `number` which can be a `float`. Fixes #3782 BREAKING CHANGE: rateIn/rateOut are returned as numbers
The return type for `rateIn`/`rateOut` should be a number and not an integer. go-IPFS returns a `float64` which isn't representable in js, but we are not interested in that level of accuracy for this value so just return it as a regular `number` which can be a `float`. Fixes #3782 BREAKING CHANGE: rateIn/rateOut are returned as numbers
Version:
ipfs-http-client: 51.0.1
go-ipfs: 0.9.1
Platform:
Darwin jure.local 18.7.0 Darwin Kernel Version 18.7.0: Tue Jun 22 19:37:08 PDT 2021; root:xnu-4903.278.70~1/RELEASE_X86_64 x86_64
Subsystem:
stats.bw
Severity:
Medium - A non-essential functionality does not work, performance issues, etc.
Description:
I suspect this issue is related to #3726 and it's subsequent fix in #3735. I'm getting the same error as the user in the OP, namely:
The number xxxx.yyyy cannot be converted to a BigInt because it is not an integer
I have fixed the issue by changing the code in ipfs-http-client/src/stats/bw.js by following the lead in #3735 like so:
This works fine as a quick fix but I'm not sure if:
Math.Round
is the way you want to approach solving thisIf it's something you would like to have fixed in ipfs-http-client I'd be happy to submit a PR, but I can't help you with the golang side of things. Any advice would be much appreciated!
Steps to reproduce the error:
Set up ipfs-http-client to work with the go-ipfs npm package and run:
The text was updated successfully, but these errors were encountered: