witnet / witnet-requests-js

Witnet Requests Javascript Library
MIT License
5 stars 11 forks source link

Erratic errors on erratic sources ? #52

Closed guidiaz closed 2 years ago

guidiaz commented 2 years ago

Command: npx witnet-toolkit try-request-update --hex 0ae20412550801123968747470733a2f2f6170692e62696e616e63652e636f6d2f6170692f76332f7469636b65722f70726963653f73796d626f6c3d4f4d474554481a168418778218646570726963658218571a3b9aca00185b12480801122d68747470733a2f2f646174612e676174656170692e696f2f617069322f312f7469636b65722f6f6d675f6574681a15841877821864646c6173748218571a3b9aca00185b125b0801123f68747470733a2f2f636f696e7965702e636f6d2f6170692f76312f3f66726f6d3d4f4d4726746f3d455448266c616e673d657326666f726d61743d6a736f6e1a168418778218646570726963658218571a3b9aca00185b1291010801125a68747470733a2f2f646174612e6d6573736172692e696f2f6170692f76312f6173736574732f6f6d672f6d6574726963732f6d61726b65742d646174613f6669656c64733d6d61726b65745f646174612f70726963655f6574681a3186187782186664646174618218666b6d61726b65745f646174618218646970726963655f6574688218571a3b9aca00185b124d0801122c68747470733a2f2f6170692e62697466696e65782e636f6d2f76312f7075627469636b65722f6f6d676574681a1b8418778218646a6c6173745f70726963658218571a3b9aca00185b12610801123268747470733a2f2f6170692e6b72616b656e2e636f6d2f302f7075626c69632f5469636b65723f706169723d4f4d474554481a2987187782186666726573756c74821866664f4d4745544882186161618216008218571a3b9aca00185b1a0d0a0908051205fa402000001003220d0a0908051205fa40200000100310c0843d180a20c0843d28463080e497d012

Sometimes works, some others produces this error:

    at Generator.invoke [as _invoke] (/home/pn/app/node_modules/regenerator-runtime/runtime.js:294:22)
    at Generator.next (/home/pn/app/node_modules/regenerator-runtime/runtime.js:119:21)
    at asyncGeneratorStep (/home/pn/app/node_modules/witnet-requests/dist/witnet/toolkit.js:38:103)
    at _next (/home/pn/app/node_modules/witnet-requests/dist/witnet/toolkit.js:40:194)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use `node --trace-warnings ...` to show where the warning was created)

(node:4902) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

(node:4902) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Cannot dry run request: 0ae20412550801123968747470733a2f2f6170692e62696e616e63652e636f6d2f6170692f76332f7469636b65722f70726963653f73796d626f6c3d4f4d474554481a168418778218646570726963658218571a3b9aca00185b12480801122d68747470733a2f2f646174612e676174656170692e696f2f617069322f312f7469636b65722f6f6d675f6574681a15841877821864646c6173748218571a3b9aca00185b125b0801123f68747470733a2f2f636f696e7965702e636f6d2f6170692f76312f3f66726f6d3d4f4d4726746f3d455448266c616e673d657326666f726d61743d6a736f6e1a168418778218646570726963658218571a3b9aca00185b1291010801125a68747470733a2f2f646174612e6d6573736172692e696f2f6170692f76312f6173736574732f6f6d672f6d6574726963732f6d61726b65742d646174613f6669656c64733d6d61726b65745f646174612f70726963655f6574681a3186187782186664646174618218666b6d61726b65745f646174618218646970726963655f6574688218571a3b9aca00185b124d0801122c68747470733a2f2f6170692e62697466696e65782e636f6d2f76312f7075627469636b65722f6f6d676574681a1b8418778218646a6c6173745f70726963658218571a3b9aca00185b12610801123268747470733a2f2f6170692e6b72616b656e2e636f6d2f302f7075626c69632f5469636b65723f706169723d4f4d474554481a2987187782186666726573756c74821866664f4d4745544882186161618216008218571a3b9aca00185b1a0d0a0908051205fa402000001003220d0a0908051205fa40200000100310c0843d180a20c0843d28463080e497d012

Although not 100% sure, conflicting source seems to be this one:

// Retrieves ETH price of OMG from the coinyep API
const coinyep = new Witnet.Source("https://coinyep.com/api/v1/?from=OMG&to=ETH&lang=es&format=json")
  .parseJSONMap() // Parse a Map from the retrieved String
  .getFloat("price") // Get the `Float` value associated to the `price` key
  .multiply(10 ** 9) // Use 9 digit precision
  .round()
guidiaz commented 2 years ago

I believe witnet-toolkit should: