Requires undocumented init method on challenge #2

Open
opened 2019-08-21 13:08:25 +00:00 by Ghost · 1 comment

Attempting to run the tests throws the following error:

/home/casey/code/le-challenge-redis/node_modules/acme-challenge-test/index.js:39
  var fn = obj[name].bind(obj);
                     ^
TypeError: Cannot read property 'bind' of undefined
    at promiseCheckAndCatch (/home/casey/code/le-challenge-redis/node_modules/acme-challenge-test/index.js:39:22)
    at wrapChallenger (/home/casey/code/le-challenge-redis/node_modules/acme-challenge-test/index.js:359:11)
    at testEach (/home/casey/code/le-challenge-redis/node_modules/acme-challenge-test/index.js:121:13)
    at Object.testRecord (/home/casey/code/le-challenge-redis/node_modules/acme-challenge-test/index.js:423:10)
    at Object.<anonymous> (/home/casey/code/le-challenge-redis/test.ts:8:4)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Module.m._compile (/home/casey/code/le-challenge-redis/node_modules/ts-node/src/index.ts:473:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Object.require.extensions.<computed> [as .ts] (/home/casey/code/le-challenge-redis/node_modules/ts-node/src/index.ts:476:12)
    at Module.load (internal/modules/cjs/loader.js:641:32)
error Command failed with exit code 1.

After investigation, it's trying to access init. Funny enough, this is almost handled.

From index.js...

  var init = challenger.init;
  if ('function' !== typeof init) {
    init = function(opts) {
      return null;
    };
  }
  return {
    init: promiseCheckAndCatch(challenger, 'init'),
    ...
  }

Rather than re-assigning the var, challenger.init = function() { return null } should be used.

Attempting to run the tests throws the following error: ```shell /home/casey/code/le-challenge-redis/node_modules/acme-challenge-test/index.js:39 var fn = obj[name].bind(obj); ^ TypeError: Cannot read property 'bind' of undefined at promiseCheckAndCatch (/home/casey/code/le-challenge-redis/node_modules/acme-challenge-test/index.js:39:22) at wrapChallenger (/home/casey/code/le-challenge-redis/node_modules/acme-challenge-test/index.js:359:11) at testEach (/home/casey/code/le-challenge-redis/node_modules/acme-challenge-test/index.js:121:13) at Object.testRecord (/home/casey/code/le-challenge-redis/node_modules/acme-challenge-test/index.js:423:10) at Object.<anonymous> (/home/casey/code/le-challenge-redis/test.ts:8:4) at Module._compile (internal/modules/cjs/loader.js:774:30) at Module.m._compile (/home/casey/code/le-challenge-redis/node_modules/ts-node/src/index.ts:473:23) at Module._extensions..js (internal/modules/cjs/loader.js:785:10) at Object.require.extensions.<computed> [as .ts] (/home/casey/code/le-challenge-redis/node_modules/ts-node/src/index.ts:476:12) at Module.load (internal/modules/cjs/loader.js:641:32) error Command failed with exit code 1. ``` After investigation, it's trying to access `init`. Funny enough, this is _almost_ handled. From [index.js](https://git.rootprojects.org/root/acme-challenge-test.js/src/branch/master/index.js#L348-L355)... ```javascript var init = challenger.init; if ('function' !== typeof init) { init = function(opts) { return null; }; } return { init: promiseCheckAndCatch(challenger, 'init'), ... } ``` Rather than re-assigning the var, `challenger.init = function() { return null }` should be used.
Owner

Sorry for the late response, I was on vacation.

You are correct. I'll update this and publish.

Sorry for the late response, I was on vacation. You are correct. I'll update this and publish.
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: root/acme-challenge-test.js#2
No description provided.