digitalbazaar / jsonld-signatures

An implementation of the Linked Data Signatures specification for JSON-LD. Works in the browser and Node.js.
BSD 3-Clause "New" or "Revised" License
138 stars 41 forks source link

UnhandledPromiseRejectionWarning: Error: A URL "https://www.w3.org/ns/did/v1" could not be fetched; you need to pass "documentLoader" or resolve the URL before calling #97

Closed zhanb closed 4 years ago

zhanb commented 4 years ago

(node:29197) UnhandledPromiseRejectionWarning: Error: A URL "https://www.w3.org/ns/did/v1" could not be fetched; you need to pass "documentLoader" or resolve the URL before calling "sign". at Object.sign (/root/did/json-ld-signature/node_modules/jsonld-signatures/lib/jsonld-signatures.js:26:19) at at process._tickCallback (internal/process/next_tick.js:188:7) at Function.Module.runMain (module.js:695:11) at startup (bootstrap_node.js:188:16) at bootstrap_node.js:609:3 (node:29197) 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(). (rejection id: 4) (node:29197) [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.

aljones15 commented 4 years ago

the issue here is the documentLoader could not dereference the url for your did json-ld context: https://www.w3.org/ns/did/v1. You can pass in a documentLoader as a parameter to sign. The other problem might be that your existing documentLoader needs to know where to load that context from. This might be a little confusing, but just because a context has a url does not necessarily mean it will be fetched from the internet. Some of the more secure implementations of jsonld only fetch json-ld contexts from local sources as a security precaution.

mandyvenables commented 4 years ago

@zhanb Does the comment above answer your question? If so, please close the issue. Thanks!