XRPLF / xrpl.js

A JavaScript/TypeScript API for interacting with the XRP Ledger in Node.js and the browser
https://xrpl.org/
1.2k stars 511 forks source link

SchemaError: no such schema </tag> #880

Closed enVolt closed 6 years ago

enVolt commented 6 years ago

Hi, I'm getting error, when using preparePayment. This was working fine earlier, but started to happen after I updated all the node modules.

Here is the code snippet -

const Ripple = require('ripple-lib').RippleAPI;
const rippleAPI = new Ripple();

rippleAPI.preparePayment("rETGqb26BRybn3KL8rS779yZviLNmhzYxC", { source:
   { address: 'rETGqb26BRybn3KL8rS779yZviLNmhzYxC',
     maxAmount: { value: '200', currency: 'XRP' } },
  destination:
   { address: 'rUfBESf5m9X9NNGwS3rq2azkcL1sYW8nM8',
     tag: 313953,
     amount: { value: '200', currency: 'XRP' } } } , { fee: '0.000012', maxLedgerVersion: 10, sequence: 1 });

Here is the version tree for Ripple and it's submodules -

├─┬ ripple-lib@0.17.9
│ ├── bignumber.js@4.1.0
│ ├─┬ https-proxy-agent@1.0.0
│ │ ├─┬ agent-base@2.1.1
│ │ │ └── semver@5.0.3
│ │ └── debug@2.6.9
│ ├── jsonschema@1.2.3
│ ├── lodash@4.17.5
│ ├─┬ ripple-address-codec@2.0.1
│ │ └─┬ x-address-codec@0.7.2
│ │   └── base-x@1.1.0
│ ├─┬ ripple-binary-codec@0.1.13
│ │ ├─┬ babel-runtime@6.26.0
│ │ │ ├── core-js@2.5.4
│ │ │ └── regenerator-runtime@0.11.1
│ │ └── decimal.js@5.0.8
│ ├─┬ ripple-hashes@0.3.1
│ │ └── bignumber.js@4.1.0
│ ├─┬ ripple-keypairs@0.10.1
│ │ ├── babel-runtime@5.8.38
│ │ ├── bn.js@3.3.0
│ │ └── elliptic@5.2.1
│ ├─┬ ripple-lib-transactionparser@0.6.2
│ │ └── bignumber.js@4.1.0
│ └─┬ ws@3.3.3
│   ├── async-limiter@1.0.0
│   └── ultron@1.1.1

Stack Trace of the Error -

/ripple-dir/node_modules/jsonschema/lib/validator.js:258
    throw new SchemaError("no such schema <" + switchSchema + ">", schema);
    ^
SchemaError: no such schema </tag>
    at Validator.resolve (/ripple-dir/node_modules/jsonschema/lib/validator.js:258:11)
    at Validator.validateSchema (/ripple-dir/node_modules/jsonschema/lib/validator.js:185:25)
    at Validator.validateProperties (/ripple-dir/node_modules/jsonschema/lib/attribute.js:199:20)
    at Validator.validateSchema (/ripple-dir/node_modules/jsonschema/lib/validator.js:197:34)
    at Validator.validateSchema (/ripple-dir/node_modules/jsonschema/lib/validator.js:187:17)
    at Validator.testSchemaNoThrow (/ripple-dir/node_modules/jsonschema/lib/attribute.js:64:18)
    at Array.filter (native)
    at Validator.validateOneOf (/ripple-dir/node_modules/jsonschema/lib/attribute.js:161:28)
    at Validator.validateSchema (/ripple-dir/node_modules/jsonschema/lib/validator.js:197:34)
    at Validator.validateSchema (/ripple-dir/node_modules/jsonschema/lib/validator.js:187:17)

I'm absolutely certain, that the following code used to work. It only started to happen once I updated all the modules. Please suggest.

intelliot commented 6 years ago

Hmm, this looks like a breaking change in the jsonschema dependency. Add the following to your package.json:

"resolutions": {
  "jsonschema": "1.2.2"
}

You may need to use something like yarn upgrade to re-update the node modules.

Does that work?

If so, I'll release an update that pins jsonschema to 1.2.2. I'll also look into what was changed in 1.2.3.

FredKSchott commented 6 years ago

+1 On Mon, Apr 2, 2018 at 2:23 PM Elliot Lee notifications@github.com wrote:

Hmm, this looks like a breaking change in the jsonschema dependency. Add the following to your package.json:

"resolutions": { "jsonschema": "1.2.2" }

You may need to use something like yarn upgrade to re-update the node modules.

Does that work?

If so, I'll release an update that pins jsonschema to 1.2.2. I'll also look into what was changed in 1.2.3.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ripple/ripple-lib/issues/880#issuecomment-378051043, or mute the thread https://github.com/notifications/unsubscribe-auth/AAl-kyqtxv20JxP3gLem5EMUaotVepbpks5tkpbGgaJpZM4TDhJv .

enVolt commented 6 years ago

I'm using npm (version - 3.10.10). I did npm i jsonschema@1.2.2, which also updated the child module version.

Tree is now this -

├─┬ ripple-lib@0.19.1
│ ├── @types/lodash@4.14.106
│ ├─┬ @types/ws@3.2.1
│ │ └── @types/node@9.6.1
│ ├── bignumber.js@4.1.0
│ ├─┬ https-proxy-agent@1.0.0
│ │ ├─┬ agent-base@2.1.1
│ │ │ └── semver@5.0.3
│ │ └── debug@2.6.9
│ ├── jsonschema@1.2.2
│ ├── lodash@4.17.5
│ ├─┬ ripple-address-codec@2.0.1
│ │ └─┬ x-address-codec@0.7.2
│ │   └── base-x@1.1.0
│ ├─┬ ripple-binary-codec@0.1.13
│ │ ├─┬ babel-runtime@6.26.0
│ │ │ ├── core-js@2.5.4
│ │ │ └── regenerator-runtime@0.11.1
│ │ └── decimal.js@5.0.8
│ ├─┬ ripple-hashes@0.3.1
│ │ └── bignumber.js@4.1.0
│ ├─┬ ripple-keypairs@0.10.1
│ │ ├── babel-runtime@5.8.38
│ │ ├── bn.js@3.3.0
│ │ └── elliptic@5.2.1
│ ├─┬ ripple-lib-transactionparser@0.6.2
│ │ └── bignumber.js@4.1.0
│ └─┬ ws@3.3.3
│   ├── async-limiter@1.0.0
│   └── ultron@1.1.1

And yes, this is working fine now.

awwright commented 6 years ago

I noted in https://github.com/tdegrunt/jsonschema/issues/253 that /tag isn't a valid URI (it's a URI Reference, though). Try prepending a valid URI, like vnd.jsonschema:/// instead of just /.

Afroj01 commented 6 years ago

Sir I request my 264 ripple recover my wallet

intelliot commented 6 years ago

Using vnd.jsonschema:/// didn't seem to make a difference. However, I'm not clear on how jsonschema works, so there might be something obvious going wrong. We can continue the discussion at https://github.com/tdegrunt/jsonschema/issues/253