Closed OR13 closed 2 years ago
@OR13
There's a RangeError in serializing implementationResults
as JSON:
https://github.com/decentralized-identity/JWS-Test-Suite/runs/4157384700?check_suite_focus=true#step:8:23
https://github.com/decentralized-identity/JWS-Test-Suite/blob/cc3079650c020852919a1d11f811649192d56bdf/evaluate.js#L104
Maybe some kind of circular data structure. Here it is narrowed down to an error object:
> implementationResults.spruce['credential-0--key-4-rsa2048.vc.json'].verification.error.errors[0]
Error: getKeyPairForKtyAndCrv does not support: RSA and undefined
at getKeyPairForKtyAndCrv (/home/cel/src/JWS-Test-Suite/implementations/transmute/node_modules/@transmute/json-web-signature/dist/json-web-signature.cjs.development.js:845:9)
at getKeyPairForType (/home/cel/src/JWS-Test-Suite/implementations/transmute/node_modules/@transmute/json-web-signature/dist/json-web-signature.cjs.development.js:850:12)
at _callee7$ (/home/cel/src/JWS-Test-Suite/implementations/transmute/node_modules/@transmute/json-web-signature/dist/json-web-signature.cjs.development.js:1225:23)
at tryCatch (/home/cel/src/JWS-Test-Suite/implementations/transmute/node_modules/@transmute/json-web-signature/dist/json-web-signature.cjs.development.js:136:40)
at Generator.invoke [as _invoke] (/home/cel/src/JWS-Test-Suite/implementations/transmute/node_modules/@transmute/json-web-signature/dist/json-web-signature.cjs.development.js:366:22)
at Generator.next (/home/cel/src/JWS-Test-Suite/implementations/transmute/node_modules/@transmute/json-web-signature/dist/json-web-signature.cjs.development.js:191:21)
at asyncGeneratorStep (/home/cel/src/JWS-Test-Suite/implementations/transmute/node_modules/@transmute/json-web-signature/dist/json-web-signature.cjs.development.js:18:24)
at _next (/home/cel/src/JWS-Test-Suite/implementations/transmute/node_modules/@transmute/json-web-signature/dist/json-web-signature.cjs.development.js:40:9)
at /home/cel/src/JWS-Test-Suite/implementations/transmute/node_modules/@transmute/json-web-signature/dist/json-web-signature.cjs.development.js:47:7
at new Promise (<anonymous>)
Stringifying that error object results in the same RangeError:
> JSON.stringify(implementationResults.spruce['credential-0--key-4-rsa2048.vc.json'].verification.error.errors[0])
Uncaught RangeError: Maximum call stack size exceeded
at JSON.stringify (<anonymous>)
at Error.value (/home/cel/src/JWS-Test-Suite/implementations/transmute/node_modules/@transmute/linked-data-proof/dist/linked-data-proof.cjs.development.js:626:23)
at JSON.stringify (<anonymous>)
at Error.value (/home/cel/src/JWS-Test-Suite/implementations/transmute/node_modules/@transmute/linked-data-proof/dist/linked-data-proof.cjs.development.js:626:23)
at JSON.stringify (<anonymous>)
at Error.value (/home/cel/src/JWS-Test-Suite/implementations/transmute/node_modules/@transmute/linked-data-proof/dist/linked-data-proof.cjs.development.js:626:23)
at JSON.stringify (<anonymous>)
at Error.value (/home/cel/src/JWS-Test-Suite/implementations/transmute/node_modules/@transmute/linked-data-proof/dist/linked-data-proof.cjs.development.js:626:23)
at JSON.stringify (<anonymous>)
at Error.value (/home/cel/src/JWS-Test-Suite/implementations/transmute/node_modules/@transmute/linked-data-proof/dist/linked-data-proof.cjs.development.js:626:23)
But after deleting those error objects, RangeError still occurs - so it seems to be coming from somewhere else as well.
The following change makes RangeError go away, allowing evaluate.js
to complete:
diff --git a/evaluate.js b/evaluate.js
index 229f4b8..7ec4014 100644
--- a/evaluate.js
+++ b/evaluate.js
@@ -99,6 +99,13 @@ const extendIndexWithEvaluations = async (index) => {
"./data/implementations/index.json"
);
+ for (const imp in implementationResults) {
+ for (const k in implementationResults[imp]) {
+ delete implementationResults[imp][k].verification.error
+ delete implementationResults[imp][k].verification.credentials
+ delete implementationResults[imp][k].verification.presentation
+ }
+ }
fs.writeFileSync(
indexOutputPath,
JSON.stringify(implementationResults, null, 2)
Not just Spruce's evaluation not rendering, but no new evaluation rendering, because the evaluation file fails to be written. This is not obvious because that error was not caught; #30 fixes that. #29 fixed the evaluation build for me, although it would be better to not put the offending values in the object in the first place.
@clehner thanks, probably this error is upstream as well, we should ensure that errors are safe to serialize...
I opened https://github.com/transmute-industries/verifiable-data/issues/120 to track it on our end.
https://identity.foundation/JWS-Test-Suite/#implementations
@clehner any idea why the CI is not deploying results for spruce?