Verifiable Credential: Uncaught (in promise) kt: Call failed:

I’m implementing the VC, and the get_credential function is always responding with this error:

Here is the generated JWS:

eyJhbGciOiJIUzI1NiIsImtpZCI6ImRpZDppY3A6aGVxNTItZzd1dGotbHA1NGQtYmNiNzcta3ltYm0tbWh2aGQtdTV0M3ktYnB5aXAtNG01emItMmlobGUtaHFlIn0.eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiSUNQMTAxQ29tcGxldGlvbiJdLCJpc3N1ZXIiOiJodHRwczovL2lkZW50aXR5LmljMC5hcHAvIiwiaXNzdWFuY2VEYXRlIjoiMjAyNC0wOS0wN1QxODoxOTozNy43NzhaIiwiZXhwaXJhdGlvbkRhdGUiOiIyMDI0LTA5LTA3VDE4OjM0OjM3Ljc3OFoiLCJjcmVkZW50aWFsU3ViamVjdCI6eyJpZCI6ImRpZDppY3A6aGVxNTItZzd1dGotbHA1NGQtYmNiNzcta3ltYm0tbWh2aGQtdTV0M3ktYnB5aXAtNG01emItMmlobGUtaHFlIiwiSUNQMTAxQ29tcGxldGlvbiI6eyJpc3N1ZWRPbiI6IjIwMjQtMDQtMjRUMTM6MjY6MTguNTc1WiIsImlzc3Vlck5hbWUiOiJEYWNhZGUiLCJsaW5rVG9Xb3JrIjoiaHR0cHM6Ly9kYWNhZGUub3JnL3N1Ym1pc3Npb25zL2Q2OTkzNjMwLWVmNjEtNDAzMC1hZjIzLTkxMDY5ZGE5ZWUxNSIsInJlY2lwaWVudE5hbWUiOiJSb3V2ZW4iLCJuYW1lIjoiVHlwZVNjcmlwdCBTbWFydCBDb250cmFjdCAxMDEifX0sImlkIjoiZGF0YTp0ZXh0L3BsYWluO2NoYXJzZXQ9VVRGLTgsaXNzdWVyOmh0dHBzOi8vaWRlbnRpdHkuaWMwLmFwcC8sdGltZXN0YW1wX25zOjE3MjU3MzMxNzc3NzgwMDAwMDAsc3ViamVjdDpoZXE1Mi1nN3V0ai1scDU0ZC1iY2I3Ny1reW1ibS1taHZoZC11NXQzeS1icHlpcC00bTV6Yi0yaWhsZS1ocWUifQ.fRW8O7xtyrFAsOp0gKb-4ZGwcbUz-Yf96fo9uGe8W_Q

Here is the code requesting the VC from the frontend:

 const requestVC = () => {
    requestVerifiablePresentation({
      onSuccess: (verifiablePresentation: VerifiablePresentationResponse) => {
        console.log({ verifiablePresentation });
      },
      onError: (err: any) => {
        console.log("An error occurred", err);
      },
      issuerData: {
        origin: "http://bd3sg-teaaa-aaaaa-qaaba-cai.localhost:4943",
        canisterId: Principal.fromText("bd3sg-teaaa-aaaaa-qaaba-cai"),
      },
      credentialData: {
        credentialSpec: {
          credentialType: "ICP101Completion",
          arguments: {
            issuedOn,
            issuerName,
            linkToWork,
            recipientName,
            name,
          },
        },
        credentialSubject: Principal.fromText(principal),
      },
      identityProvider: new URL(IDENTITY_PROVIDER),
    });
  };

Note: My internet Identity is running locally as well as the issuer canister itself.

I would appraciate any help on this, maybe I’m missing something.

This is the codebase as well: dacade-vc-issuer/src/index.ts at main · dacadeorg/dacade-vc-issuer · GitHub still not done yet, but if there is any feedback it would also be great :slightly_smiling_face:

Hi!

The error comes from Internet Identity page, right?

The problem seems to come from the get_credential implementation. I don’t think it’s the frontend code, that looks good.

Could you put all the code in get_credential inside a try/catch to check whether there is a problem somewhere?

Hi, I solved it; I found that the data returned by the get_credential was not the one specified in the candid interace.

I guess there could be a room for better error messages :slightly_smiling_face:

Yes, that’s true. Normally we catch this at compile time, before even deploying the canister. But that’s when you use Rust.