I tried to configure the MicroGateway on my windows machine (Apigee Edge in the cloud), but i am getting the following error during configuration.
PS C:\Users\XXX> edgemicro.cmd configure -o xxxxx -e test -v default -u xxxx@xxxxx.com
current nodejs version is v8.11.3
current edgemicro version is 2.5.26
password:
file doesn’t exist, setting up checking org for existing KVM
error checking for cert.
Installing new cert. creating KVM adding private_key adding public_key C:\Users\XXX\AppData\Roaming\npm\node_modules\edgemicro\cli\lib\cert-lib.js:187 ‘value’: key.publicKey ^ TypeError: Cannot read property ‘publicKey’ of undefined at C:\Users\XXX\AppData\Roaming\npm\node_modules\edgemicro\cli\lib\cert-lib.js:187:30 at C:\Users\XXX\AppData\Roaming\npm\node_modules\edgemicro\node_modules\async\lib\async.js:718:13 at Immediate.iterate [as _onImmediate] (C:\Users\XXX\AppData\Roaming\npm\node_modules\edgemicro\node_modules\async\lib\async.js:262:13) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5)
1 Like
I presume openssl was installed and available in the path. Can you please confirm if a KVM called “microgateway” was created and the key and cert installed on it?
I have exactly the same error, i also tried to upgrade npm and node.js , edgemicro-auth proxy is created in Edge. There is no KVM created though. Please find the stack trace
current nodejs version is v10.10.0
current edgemicro version is 2.5.26
password:
file doesn’t exist, setting up
checking org for existing KVM
error checking for cert. Installing new cert.
creating KVM
adding private_key
adding public_key
C:\Users_nairr\AppData\Roaming\npm\node_modules\edgemicro\cli\lib\cert-lib.js:187
‘value’: key.publicKey
^
TypeError: Cannot read property ‘publicKey’ of undefined
at C:\Users_nairr\AppData\Roaming\npm\node_modules\edgemicro\cli\lib\cert-lib.js:187:30
at C:\Users_nairr\AppData\Roaming\npm\node_modules\edgemicro\node_modules\async\lib\async.js:718:13
at Immediate.iterate (C:\Users_nairr\AppData\Roaming\npm\node_modules\edgemicro\node_modules\async\lib\async.js:262
:13)
at runCallback (timers.js:694:18)
at tryOnImmediate (timers.js:665:5)
at processImmediate (timers.js:647:5)
For my case KVM was not created, stack trace is exactly similar to Jeff. I tried to configure with Apigee Evaluation version and Paid version, bot gives the same error.
same question - is OpenSSL installed and in the path?
Open SSL is installed and is in path, i am running in Windows 7 though
Are you an “orgadmin” in the Apigee org?
Configuration YAML just in case it rings any bell
edge_config: bootstrap: https://apigee.net/edgemicro/bootstrap/organization/org/environment/env. jwt_public_key: http://apigee.net/edgemicro/publicKey. managementUri: https://api.enterprise.apigee.com vaultName: microgateway authUri: https://%s-%s.apigee.net/edgemicro-auth baseUri: https://edgemicroservices.apigee.net/edgemicro/%s/organization/%s/environment/%s bootstrapMessage: Please copy the following property to the edge micro agent config keySecretMessage: The following credentials are required to start edge micro edgemicro: port: 8000 max_connections: 1000 config_change_poll_interval: 600 logging: level: error dir: /var/tmp stats_log_interval: 60 rotate_interval: 24 plugins: sequence: - oauth headers: x-forwarded-for: true x-forwarded-host: true x-request-id: true x-response-time: true via: true oauth: allowNoAuthorization: false allowInvalidAuthorization: false
No, that’s not helping. The key/cert is not being generated is what I can tell from the stacktrace.
There is a line which says installing Cert and then it proceeds to KVM, while creating Public_key key it has some issue, is this because of NPM version 6.4.1 or the issue with Latest Microgateway version
I can confirm this bug. Will post an update soon.
Thanks all. I can confirm the following
-
Open SSL installed and working on Win10 (I also tried on a Mac with the same error).
-
I configured as orgadmin.
-
Didn’t use a trial account.
-
No new KVM was created.
@srinandans - also, when you say it is a bug so a fix is on the way? 
Something strange is happening. I have tried this 3-4 times. And it only failed once. Maybe the management api is timing out. Does it happen if you try it again?
hi @srinandans - I have tried many times - and never worked. I had a look at the source code, but could not figure out where the key object is created.
createCert(function(err, keys) {
if (err) {
return callback(err);
}
const privateKey = keys.serviceKey;
const publicKey = keys.certificate;
const async = require('async');
pem.getPublicKey (publicKey, function(err, key) {
async.series(
[
function(cb) {
if (!options.force) { return cb(); }
deleteVault(generateCredentialsObject(options), managementUri, options.org, options.env, vaultName, cb);
},
function(cb) {
console.log('creating KVM');
console.log('adding private_key');
console.log('adding public_key');
var entries = [
{
'name':'private_key',
'value': privateKey
},
{
'name': 'public_key',
'value': publicKey
},
{
'name': 'public_key1',
'value': key.publicKey // where is key defined?
},
strange - looks like the key was not created. Can you please explain to me the differences between the public_key and public_key1?
It is still not working for me.
also
current nodejs version is v8.11.3
current edgemicro version is 2.5.26
could this be an issue?
Nope, I’m using the same version (on mac).
public_key actually contains the certificate and public_key1 contains the RSA public key.