Skip to content

Commit

Permalink
debugging missing dtid in redis on accept
Browse files Browse the repository at this point in the history
  • Loading branch information
suculent committed Nov 16, 2023
1 parent f161e3d commit 209a42a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 1 addition & 3 deletions lib/router.transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions lib/thinx/transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}

Expand Down
4 changes: 2 additions & 2 deletions spec/jasmine/ApikeySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand Down

0 comments on commit 209a42a

Please sign in to comment.