uport-connect
uport-connect copied to clipboard
" Error: Unsupported DID method: 'ethr' " when requesting disclosure on meteor client side
When doing a simple disclosure request on the client side of my meteor app, I get the following error:
Uncaught (in promise) Error: Unsupported DID method: 'ethr'
using this code:
import { Connect } from 'uport-connect';
uportCreateUportID(event){
event.preventDefault();
const uport = new Connect('Test DApp');
const reqID = 'disclosureReq'
uport.requestDisclosure()
uport.onResponse('disclosureReq').then(res => {
json = JSON.stringify(res.payload)
console.log(json)
})
}
Any clue what this issue might be?
Same here.
Angular here (specifically angular-cli); tested with angular versions 6 and 7.
After testing for a while it seems like the issue comes with uport-connect
dependencies. Either if you set to 1.0.0-alpha-5
or 1.1.0-alpha.12
(which were working versions at the time), it breaks, probably because their dependencies. For example, uport-credentials
always comes at the latest 1.1.x
version.
Full error log:
core.js:1673 ERROR Error: Uncaught (in promise): Error: Unsupported DID method: 'ethr'
Error: Unsupported DID method: 'ethr'
at resolver.js:42
at new Promise (es6.promise.js:177)
at resolve (resolver.js:36)
at _callee3$ (JWT.js:274)
at tryCatch (runtime.js:62)
at Generator.invoke [as _invoke] (runtime.js:296)
at Generator.prototype.(:4201/anonymous function) [as next] (http://localhost:4201/vendor.js:101796:21)
at step (asyncToGenerator.js:17)
at asyncToGenerator.js:35
at new Promise (es6.promise.js:177)
at resolvePromise (zone.js:831)
at zone.js:741
at rejected (main.js:136)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
at Object.onInvoke (core.js:3820)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:390)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (zone.js:150)
at zone.js:889
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
at Object.onInvokeTask (core.js:3811)
(resolver)
When executed with <script src="https://unpkg.com/[email protected]/dist/uport-connect.js"></script>
it works alright, because it was transpiled with the appropriate dependencies.
Either way, dependencies might not be the only to blame for, since it seems to work with React.
UPDATE
Calling registerResolver()
seems to solve the issue. For those who are having this issue as well, dependency does not need to be installed manually sinceuport-connect
-> uport-credentials
-> already carriesethr-did-resolver
.
import registerResolver from 'ethr-did-resolver';
registerResolver();
The working version here.
IMO the issue comes from the package ethr-did-resolver
on version 0.2.0
. Previously uport-connect
and uport-credentials
were using the version ^0.1.0
. And rolling back to uport-connect
1.1.0
can't fix the issue while It depends on uport-credentials
^1.1.0
that resolves to 1.1.3
(that is using ethr-did-resolver
on version 0.2.0
).
Issue can also come from package did-jwt
that has been updated (from ^0.0.9
to ^0.1.0
) on latest uport-credentials
versions.
I succeeded to workaround the issue by forcing versions on yarn.lock
file, but that's obviously not a recommended fix…