From 209a42ac21d22621fddef70f5e2db9ec3711f436 Mon Sep 17 00:00:00 2001 From: Matej Sychra Date: Thu, 16 Nov 2023 18:26:55 +0100 Subject: [PATCH] debugging missing dtid in redis on accept --- lib/router.transfer.js | 4 +--- lib/thinx/transfer.js | 5 +++-- spec/jasmine/ApikeySpec.js | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/router.transfer.js b/lib/router.transfer.js index cea683c6c..b35741ddc 100644 --- a/lib/router.transfer.js +++ b/lib/router.transfer.js @@ -13,12 +13,10 @@ module.exports = function (app) { function transferResultRedirect(success, res, response) { - /* - // solves `Headers already set` issue? + // solves `Headers already sent` issue? Why does it happen? This should not be here! if ((process.env.ENVIRONMENT === "test") || (process.env.ENVIRONMENT === "development")) { return Promise.resolve(response); } - */ if (success === false) { res.redirect(app_config.public_url + "/error.html?success=failed&reason=" + response); diff --git a/lib/thinx/transfer.js b/lib/thinx/transfer.js index e168ec441..c85756797 100644 --- a/lib/thinx/transfer.js +++ b/lib/thinx/transfer.js @@ -435,8 +435,9 @@ module.exports = class Transfer { const dtid = "dt:" + transfer_id; let encoded_json_keys = await this.redis.get(dtid); - if ((typeof (encoded_json_keys) === "undefined") || (encoded_json_keys === null)) { - console.log(`🔨 [debug] [transfer] Not found DTID: ${dtid}`); + if ((typeof (encoded_json_keys) === "undefined") || (encoded_json_keys === null)) { + const allkeys = await this.redis.keys("dt:*"); + console.log(`🔨 [debug] [transfer] Not found DTID: ${dtid} in ${{allkeys}}`, {allkeys}); return Promise.reject(new Error("accept_transfer_id_not_found_1")); } diff --git a/spec/jasmine/ApikeySpec.js b/spec/jasmine/ApikeySpec.js index a3ebba287..d6740202d 100644 --- a/spec/jasmine/ApikeySpec.js +++ b/spec/jasmine/ApikeySpec.js @@ -108,7 +108,7 @@ describe("API Key", function () { "sample-key-for-revocation", (success, array_or_error) => { expect(success).to.equal(true); - console.log("[spec] APIKey revoking: sample-key-for-revocation from", { array_or_error }); + console.log("[spec] APIKey revoking: sample-key-for-revocation of", { array_or_error }); for (let index in array_or_error) { let item = array_or_error[index]; if (item.alias.indexOf("sample-key-for-revocation") !== -1) { @@ -125,7 +125,7 @@ describe("API Key", function () { ); }); - it("(05) should return empty array on invalid API Key revocation", function (done) { + it("(05) should return empty array on invalid API Key revocation", function (done) { apikey.revoke( owner, ["sample-key-hax"], // intentionaly invalid