2
0
镜像自地址 https://git.coolaj86.com/coolaj86/acme-challenge-test.js.git 已同步 2025-05-09 02:46:33 +00:00

Requires undocumented init method on challenge #2

开启中
由 Ghost 于 2019-08-21 13:08:25 +00:00 打开 · 1 评论

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.
管理员

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.
登录 并参与到对话中。
未选择标签
2 名参与者
通知
到期时间
未设置到期时间。
依赖工单

没有设置依赖项。

参考:root/acme-challenge-test.js#2
没有提供说明。