Hello, I’m always getting this error and I cannot can around it; I get this error only when the I have something in the encoded array; with empty array the function works perfectly.
Can someone help me here?
Call was rejected:
Request ID: f5dedc34c90cf6834f153225d71e14dae31a9c00177d3d5bf8386dfd7591b0a8
Reject code: 5
Reject text: Canister bkyz2-fmaaa-aaaaa-qaaaq-cai did not reply to the call
this is my candid:
service: () -> {
derivation_origin: (record {frontend_hostname:text}) -> (variant {Ok:record {origin:text}; Err:variant {Internal:text; UnsupportedOrigin:text}});
get_credential: (record {signed_id_alias:record {credential_jws:text}; prepared_context:opt vec nat8; credential_spec:record {arguments:opt vec record {text; variant {Int:int32; String:text}}; credential_type:text}}) -> (record {Ok:record {vc_jws:text}; Err:variant {Internal:text; SignatureNotFound:text; InvalidIdAlias:text; UnauthorizedSubject:text; UnknownSubject:text; UnsupportedCredentialSpec:text}}) query;
prepare_credential: (record {signed_id_alias:record {credential_jws:text}; credential_spec:record {arguments:opt vec record {text; variant {Int:int32; String:text}}; credential_type:text}}) -> (variant {Ok:record {prepared_context:opt vec nat8}; Err:variant {Internal:text; SignatureNotFound:text; InvalidIdAlias:text; UnauthorizedSubject:text; UnknownSubject:text; UnsupportedCredentialSpec:text}});
vc_consent_message: (record {preferences:record {language:text}; credential_spec:record {arguments:opt vec record {text; variant {Int:int32; String:text}}; credential_type:text}}) -> (variant {Ok:record {consent_message:text; language:text}; Err:variant {GenericError:record {description:text; error_code:nat}; UnsupportedCanisterCall:record {description:text}; ConsentMessageUnavailable:record {description:text}}});
}
Here is the Azle/Typescrit:
@update(
[PrepareCredentialRequest],
IDL.Variant({
Ok: PreparedCredentialData,
Err: AzleIssueCredentialErrorType,
}),
)
prepare_credential(request: PrepareCredentialRequestType): { Ok: PreparedCredentialDataType } | { Err: IssueCredentialError } {
const credentialJws = request.signed_id_alias.credential_jws;
console.log({ credentialJws });
const response = new TextEncoder().encode(request.signed_id_alias.credential_jws);
return {
Ok: {
prepared_context: response
},
};
}