TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string #35

Open
opened 2020-10-26 23:44:38 +00:00 by Ghost · 2 comments

Hi, I can't get the vanilla example to work as shown in 1. Configure.

Any suggestions please?

I did see this issue, but the change to conigDir did not help #18

Thanks in advance,
Gary.

node --version
v10.18.1

Greenlock greenlock@4.0.4

node index.js

internal/validators.js:125
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:125:11)
    at Object.resolve (path.js:1080:7)
    at Object.Init._init (/Users/garysmart/projects/rps/rps-pocs/nodejs/gltest/node_modules/@root/greenlock/lib/init.js:128:14)
    at Object.greenlock._create (/Users/garysmart/projects/rps/rps-pocs/nodejs/gltest/node_modules/@root/greenlock/greenlock.js:58:22)
    at Object.G.create (/Users/garysmart/projects/rps/rps-pocs/nodejs/gltest/node_modules/@root/greenlock/greenlock.js:482:15)
    at Object.<anonymous> (/Users/garysmart/projects/rps/rps-pocs/nodejs/gltest/index.js:5:27)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
cat index.js

'use strict';

var pkg = require('./package.json');
var Greenlock = require('greenlock');
var greenlock = Greenlock.create({
    configDir: './greenlock.d/config.json',
    packageAgent: pkg.name + '/' + pkg.version,
    maintainerEmail: pkg.author,
    staging: true,
    notify: function(event, details) {
        if ('error' === event) {
            // `details` is an error object in this case
            console.error(details);
        }
    }
});

greenlock.manager
    .defaults({
        agreeToTerms: true,
        subscriberEmail: 'webhosting@example.com'
    })
    .then(function(fullConfig) {
        // ...
    });

Hi, I can't get the vanilla example to work as shown in *1. Configure*. Any suggestions please? I did see this issue, but the change to conigDir did not help https://git.rootprojects.org/root/greenlock.js/issues/18 Thanks in advance, Gary. ``` node --version v10.18.1 ``` Greenlock greenlock@4.0.4 ``` node index.js internal/validators.js:125 throw new ERR_INVALID_ARG_TYPE(name, 'string', value); ^ TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined at validateString (internal/validators.js:125:11) at Object.resolve (path.js:1080:7) at Object.Init._init (/Users/garysmart/projects/rps/rps-pocs/nodejs/gltest/node_modules/@root/greenlock/lib/init.js:128:14) at Object.greenlock._create (/Users/garysmart/projects/rps/rps-pocs/nodejs/gltest/node_modules/@root/greenlock/greenlock.js:58:22) at Object.G.create (/Users/garysmart/projects/rps/rps-pocs/nodejs/gltest/node_modules/@root/greenlock/greenlock.js:482:15) at Object.<anonymous> (/Users/garysmart/projects/rps/rps-pocs/nodejs/gltest/index.js:5:27) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) ``` ``` cat index.js 'use strict'; var pkg = require('./package.json'); var Greenlock = require('greenlock'); var greenlock = Greenlock.create({ configDir: './greenlock.d/config.json', packageAgent: pkg.name + '/' + pkg.version, maintainerEmail: pkg.author, staging: true, notify: function(event, details) { if ('error' === event) { // `details` is an error object in this case console.error(details); } } }); greenlock.manager .defaults({ agreeToTerms: true, subscriberEmail: 'webhosting@example.com' }) .then(function(fullConfig) { // ... }); ```
Member

This might not be the whole issue, but...

...I think configDir is just looking for the dir. Remove config.json from that string and see what happens.

This might not be the whole issue, but... ...I think `configDir` is just looking for the dir. Remove `config.json` from that string and see what happens.
Author

I did try that. I looked in to the code (line 28, index.js).

I added packageRoot: __dirname to the config and it resolve the problem, only to reveal the next error.

This is trying to use the acme-dns-01-cloudflare plugin. The token and it's permissions are correct.

Big bad error: ERR_INVALID_ARG_TYPE
{ TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:125:11)
    at Module.require (internal/modules/cjs/loader.js:687:3)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.P._loadHelper (/Users/garysmart/projects/rps/rps-pocs/nodejs/gltest/node_modules/@root/greenlock/plugins.js:29:32)
    at Object.P._loadChallenge (/Users/garysmart/projects/rps/rps-pocs/nodejs/gltest/node_modules/@root/greenlock/plugins.js:18:14)
    at /Users/garysmart/projects/rps/rps-pocs/nodejs/gltest/node_modules/@root/greenlock/greenlock.js:456:26
    at Array.map (<anonymous>)
    at Object.greenlock._order (/Users/garysmart/projects/rps/rps-pocs/nodejs/gltest/node_modules/@root/greenlock/greenlock.js:455:41)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  context: 'load_plugin',
  toJSON: [Function: errorToJSON],
  subject: '20rg.cfd.xxxxx.com',
  servername: '20rg.cfd.xxxxx.com',
  _site:
   { subject: '20rg.cfd.xxxxx.com',
     altnames: [ '20rg.cfd.xxxxx.com' ],
     renewAt: 1 } }
I did try that. I looked in to the code (line 28, index.js). I added `packageRoot: __dirname` to the config and it resolve the problem, only to reveal the next error. This is trying to use the acme-dns-01-cloudflare plugin. The token and it's permissions are correct. ``` Big bad error: ERR_INVALID_ARG_TYPE { TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type undefined at validateString (internal/validators.js:125:11) at Module.require (internal/modules/cjs/loader.js:687:3) at require (internal/modules/cjs/helpers.js:25:18) at Object.P._loadHelper (/Users/garysmart/projects/rps/rps-pocs/nodejs/gltest/node_modules/@root/greenlock/plugins.js:29:32) at Object.P._loadChallenge (/Users/garysmart/projects/rps/rps-pocs/nodejs/gltest/node_modules/@root/greenlock/plugins.js:18:14) at /Users/garysmart/projects/rps/rps-pocs/nodejs/gltest/node_modules/@root/greenlock/greenlock.js:456:26 at Array.map (<anonymous>) at Object.greenlock._order (/Users/garysmart/projects/rps/rps-pocs/nodejs/gltest/node_modules/@root/greenlock/greenlock.js:455:41) at process._tickCallback (internal/process/next_tick.js:68:7) context: 'load_plugin', toJSON: [Function: errorToJSON], subject: '20rg.cfd.xxxxx.com', servername: '20rg.cfd.xxxxx.com', _site: { subject: '20rg.cfd.xxxxx.com', altnames: [ '20rg.cfd.xxxxx.com' ], renewAt: 1 } } ```
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/greenlock.js#35
No description provided.