Open ties-makimura opened 2 months ago
4xx台のステータスコードが返却された場合はリトライしていない?
処理中のデータの値をログに出して確認すると,失敗した時は manifest.display.contract の値が空になっていた。 https://github.com/npocccties/chilowallet/blob/d6a211378f72614fb2e873f52a76b5c0475d71c0/server/services/issue.service.ts#L33
成功時ログ
{"level":"info","timestamp":"2024/9/6 18:09:23","pid":29,"hostname":"6623124554e7","msg":"Debug const vcJwt..."}
{"level":"info","timestamp":"2024/9/6 18:09:23","pid":29,"hostname":"6623124554e7","msg":"Debug issue Request Id Token"}
{"level":"info","timestamp":"2024/9/6 18:09:23","pid":29,"hostname":"6623124554e7","0":"https://beta.did.msidentity.com/v1.0/tenants/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/verifiableCredentials/issue","msg":"Debug const manifest.input.credentialIssuer"}
{"level":"info","timestamp":"2024/9/6 18:09:23","pid":29,"hostname":"6623124554e7","0":"https://beta.did.msidentity.com/v1.0/tenants/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/verifiableCredentials/contracts/yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy/manifest","msg":"Debug const manifest.display.contract"}
{"level":"info","timestamp":"2024/9/6 15:32:15","pid":28,"hostname":"146fea3209fa","msg":"**************end issue /api/v1/badge/convert**************"}
失敗時ログ
{"level":"info","timestamp":"2024/9/6 18:09:23","pid":29,"hostname":"6623124554e7","msg":"Debug const vcJwt..."}
{"level":"info","timestamp":"2024/9/6 18:09:23","pid":29,"hostname":"6623124554e7","msg":"Debug issue Request Id Token"}
{"level":"info","timestamp":"2024/9/6 18:09:23","pid":29,"hostname":"6623124554e7","0":"https://beta.did.msidentity.com/v1.0/tenants/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/verifiableCredentials/issue","msg":"Debug const manifest.input.credentialIssuer"}
{"level":"info","timestamp":"2024/9/6 18:09:23","pid":29,"hostname":"6623124554e7","0":"","msg":"Debug const manifest.display.contract"}
{"level":"warn","timestamp":"2024/9/6 15:29:12","pid":28,"hostname":"146fea3209fa","msg":"error retryRequest exp: AxiosError: Request failed with status code 400"}
manifestの値を追うと,manifestToken の時点で,失敗した時は display.contract がなかった https://github.com/npocccties/chilowallet/blob/d6a211378f72614fb2e873f52a76b5c0475d71c0/server/services/manifest.service.ts#L8
対処療法として,getManifest 時に必要な値がなければリトライを加えて様子見る。 (最終的にはリトライ部分はリトライ共通化の所に入れた方がよい。) https://github.com/npocccties/chilowallet/commit/684d6b836de0051393ad10ebea609308e942af6b
なお,対処療法を適応した環境でログを見ると,いきなり7回も試行されていた。。 様子見てリトライの回数を増やした方がいいかもしれない。
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:15\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"**************start issue request /api/v1/badge/convert**************\"}\n","stream":"stdout","time":"2024-09-06T09:16:15.932173306Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:18\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"**************end issue request /api/v1/badge/convert**************\"}\n","stream":"stdout","time":"2024-09-06T09:16:18.322587447Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:18\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"**************start verify issue request /api/v1/badge/convert**************\"}\n","stream":"stdout","time":"2024-09-06T09:16:18.326186093Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:18\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Attempting to fetch manifest (Attempt 1/10)\"}\n","stream":"stdout","time":"2024-09-06T09:16:18.874315612Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:19\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Manifest token retrieved successfully\"}\n","stream":"stdout","time":"2024-09-06T09:16:19.258520331Z"}
{"log":"{\"level\":\"error\",\"timestamp\":\"2024/9/6 18:16:19\",\"pid\":28,\"hostname\":\"549b823aa539\",\"0\":{},\"msg\":\"Error fetching manifest on attempt 1:\"}\n","stream":"stdout","time":"2024-09-06T09:16:19.25967699Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:19\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Retrying in 3 seconds...\"}\n","stream":"stdout","time":"2024-09-06T09:16:19.259720106Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:22\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Attempting to fetch manifest (Attempt 2/10)\"}\n","stream":"stdout","time":"2024-09-06T09:16:22.260742315Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:22\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Manifest token retrieved successfully\"}\n","stream":"stdout","time":"2024-09-06T09:16:22.632303329Z"}
{"log":"{\"level\":\"error\",\"timestamp\":\"2024/9/6 18:16:22\",\"pid\":28,\"hostname\":\"549b823aa539\",\"0\":{},\"msg\":\"Error fetching manifest on attempt 2:\"}\n","stream":"stdout","time":"2024-09-06T09:16:22.633352697Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:22\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Retrying in 3 seconds...\"}\n","stream":"stdout","time":"2024-09-06T09:16:22.633388578Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:25\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Attempting to fetch manifest (Attempt 3/10)\"}\n","stream":"stdout","time":"2024-09-06T09:16:25.63700444Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:25\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Manifest token retrieved successfully\"}\n","stream":"stdout","time":"2024-09-06T09:16:25.781848138Z"}
{"log":"{\"level\":\"error\",\"timestamp\":\"2024/9/6 18:16:25\",\"pid\":28,\"hostname\":\"549b823aa539\",\"0\":{},\"msg\":\"Error fetching manifest on attempt 3:\"}\n","stream":"stdout","time":"2024-09-06T09:16:25.782689937Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:25\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Retrying in 3 seconds...\"}\n","stream":"stdout","time":"2024-09-06T09:16:25.782717167Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:28\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Attempting to fetch manifest (Attempt 4/10)\"}\n","stream":"stdout","time":"2024-09-06T09:16:28.784809635Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:28\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Manifest token retrieved successfully\"}\n","stream":"stdout","time":"2024-09-06T09:16:28.93218184Z"}
{"log":"{\"level\":\"error\",\"timestamp\":\"2024/9/6 18:16:28\",\"pid\":28,\"hostname\":\"549b823aa539\",\"0\":{},\"msg\":\"Error fetching manifest on attempt 4:\"}\n","stream":"stdout","time":"2024-09-06T09:16:28.933112359Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:28\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Retrying in 3 seconds...\"}\n","stream":"stdout","time":"2024-09-06T09:16:28.933141483Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:31\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Attempting to fetch manifest (Attempt 5/10)\"}\n","stream":"stdout","time":"2024-09-06T09:16:31.934431805Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:32\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Manifest token retrieved successfully\"}\n","stream":"stdout","time":"2024-09-06T09:16:32.078250975Z"}
{"log":"{\"level\":\"error\",\"timestamp\":\"2024/9/6 18:16:32\",\"pid\":28,\"hostname\":\"549b823aa539\",\"0\":{},\"msg\":\"Error fetching manifest on attempt 5:\"}\n","stream":"stdout","time":"2024-09-06T09:16:32.079180552Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:32\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Retrying in 3 seconds...\"}\n","stream":"stdout","time":"2024-09-06T09:16:32.07921539Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:35\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Attempting to fetch manifest (Attempt 6/10)\"}\n","stream":"stdout","time":"2024-09-06T09:16:35.080238938Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:35\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Manifest token retrieved successfully\"}\n","stream":"stdout","time":"2024-09-06T09:16:35.311306571Z"}
{"log":"{\"level\":\"error\",\"timestamp\":\"2024/9/6 18:16:35\",\"pid\":28,\"hostname\":\"549b823aa539\",\"0\":{},\"msg\":\"Error fetching manifest on attempt 6:\"}\n","stream":"stdout","time":"2024-09-06T09:16:35.312476075Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:35\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Retrying in 3 seconds...\"}\n","stream":"stdout","time":"2024-09-06T09:16:35.312499463Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:38\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Attempting to fetch manifest (Attempt 7/10)\"}\n","stream":"stdout","time":"2024-09-06T09:16:38.314257637Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:38\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Manifest token retrieved successfully\"}\n","stream":"stdout","time":"2024-09-06T09:16:38.63773413Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:38\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"Manifest successfully retrieved and validated\"}\n","stream":"stdout","time":"2024-09-06T09:16:38.639245045Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:38\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"**************end verify issue request /api/v1/badge/convert**************\"}\n","stream":"stdout","time":"2024-09-06T09:16:38.639298771Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:38\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"**************start issue /api/v1/badge/convert**************\"}\n","stream":"stdout","time":"2024-09-06T09:16:38.639305831Z"}
{"log":"{\"level\":\"info\",\"timestamp\":\"2024/9/6 18:16:40\",\"pid\":28,\"hostname\":\"549b823aa539\",\"msg\":\"**************end issue /api/v1/badge/convert**************\"}\n","stream":"stdout","time":"2024-09-06T09:16:40.251851983Z"}
RCOSの段階だと決め打ちでManifest情報取得している? https://github.com/RCOSDP/credentialwallet_gateway/blob/main/lib/vc.ts#L59-L78
export const getManifestURL = (id: string): string => {
console.log("start getManifestURL badgeClass criteria.id=", id);
switch (id) {
case "https://www.credly.com/org/project-management-institute/badge/project-management-professional-pmp":
return "https://verifiedid.did.msidentity.com/v1.0/tenants/516c4fed-1f7f-4b23-b9f3-d80b44a2e5bf/verifiableCredentials/contracts/61ba9848-ccab-a0d5-8242-17348cab3952/manifest";
case "https://moodle.selmid.me/badges/badgeclass.php?id=1":
return "https://verifiedid.did.msidentity.com/v1.0/tenants/516c4fed-1f7f-4b23-b9f3-d80b44a2e5bf/verifiableCredentials/contracts/98ae2e87-98d8-30fd-78ad-590ec61e5a6d/manifest";
case "https://moodle.selmid.me/badges/badgeclass.php?id=2":
return "https://verifiedid.did.msidentity.com/v1.0/tenants/516c4fed-1f7f-4b23-b9f3-d80b44a2e5bf/verifiableCredentials/contracts/61ba9848-ccab-a0d5-8242-17348cab3952/manifest";
case "https://moodle.selmid.me/badges/badgeclass.php?id=3":
return "https://verifiedid.did.msidentity.com/v1.0/tenants/516c4fed-1f7f-4b23-b9f3-d80b44a2e5bf/verifiableCredentials/contracts/61ba9848-ccab-a0d5-8242-17348cab3952/manifest";
case "https://www.credly.com/org/idpro/badge/idpro-member":
return "https://beta.did.msidentity.com/v1.0/f88bec5c-c13f-4f27-972f-72540d188693/verifiableCredential/contracts/IDProMember";
case "https://www.credly.com/org/idpro/badge/cidpro-exam-writer":
return "https://beta.did.msidentity.com/v1.0/f88bec5c-c13f-4f27-972f-72540d188693/verifiableCredential/contracts/CIDProItemWriter";
case "https://www.credly.com/org/idpro/badge/cidpro-certified-foundation-level":
default:
return "https://verifiedid.did.msidentity.com/v1.0/tenants/516c4fed-1f7f-4b23-b9f3-d80b44a2e5bf/verifiableCredentials/contracts/98ae2e87-98d8-30fd-78ad-590ec61e5a6d/manifest";
}
};
対処療法として,getManifest 時に必要な値がなければリトライを加えて様子見る。 (最終的にはリトライ部分はリトライ共通化の所に入れた方がよい。) https://github.com/npocccties/chilowallet/commit/684d6b836de0051393ad10ebea609308e942af6b
リトライで様子見てたけど,急に何度リトライしてもcontract 取得できなくなった。(リトライしすぎて怒られた?) なので,取得できない場合は決めた値を使うよう追加で対処して,ひとまず進んだ。ここまで来たらリトライは不要かも。 https://github.com/npocccties/chilowallet/commit/480e7e90072e0ac9bd145f907273ab55da31c110
(環境変数を用意してて気づいたけど,既存の vc_manifest_url と 取得したい contract の値が同じだった。別途用意しなくてもいいかもしれん)
ログを見ると,issue /api/v1/badge/convert のタイミングで400エラー出ている。
期待していた動作
スクリーンショット
追記・備考