I've been trying to use the greenlock.js module for Node to try and obtain ssl certificates for a domain registered in cloudflare.
I have seen some examples on greenlock-express, however, I would like to use this module without needing to use express.
The issue is that I obtain the following error when creating the greenlock object:
internal/validators.js:120
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at validateString (internal/validators.js:120:11)
at Object.resolve (path.js:980:7)
at Object.Init._init (/git_reps/greenlock_test/node_modules/@root/greenlock/lib/init.js:128:14)
at Object.greenlock._create (/git_reps/greenlock_test/node_modules/@root/greenlock/greenlock.js:58:22)
at Object.G.create (/git_reps/greenlock_test/node_modules/@root/greenlock/greenlock.js:482:15)
at Object.<anonymous> (/git_reps/greenlock_test/greenlock-test.js:13:27)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14) {
code: 'ERR_INVALID_ARG_TYPE'
}
My code is as follows, I have not even implemented any other function yet because it breaks here:
1 'use strict'
2
3 const pkg = require ('./package.json');
4 const Greenlock = require('greenlock');
5 const acmeDnsCloudflare = require('acme-dns-01-cloudflare');
6
7 const cloudflareDns01 = new acmeDnsCloudflare({
8 token: 'dummyToken',
9 verifyPropagation: true,
10 verbose: true
11 });
13 let greenlock = Greenlock.create({
14 configDir: './greenlock.d/config.json',
15 packageAgent: pkg.name + '/' + pkg.version,
16 maintainerEmail: 'maintaner@example.com',
17 staging: true,
18 notify: function(event, details){
19 if('error'=== event){
20 console.error(details);
21 }
22 }
23 });