microgateway icon indicating copy to clipboard operation
microgateway copied to clipboard

Npm package: not able to perform the handshake with APIM

Open lkappeler opened this issue 7 years ago • 5 comments

We are trying to use the Microgateway standalone for our project.

When I clone the github repo and do the Getting Started the code works fine. When I install the Npm-Package and try to adapt the getting started code I am running into the following error

Error: not able to perform the handshake with APIM, error: Error: can not load default private key
    at Object.exports.handshakeWithAPIm (/Users/tones/Documents/Projekte/JB/sbc/microgateway-playground/node_modules/microgateway/utils/utils.js:192:14)
    at performHandshake (/Users/tones/Documents/Projekte/JB/sbc/microgateway-playground/node_modules/microgateway/lib/analytics.js:251:9)
    at sendAnalytics (/Users/tones/Documents/Projekte/JB/sbc/microgateway-playground/node_modules/microgateway/lib/analytics.js:49:3)
    at Object.<anonymous> (/Users/tones/Documents/Projekte/JB/sbc/microgateway-playground/node_modules/microgateway/lib/microgw.js:37:9)

Here is the js I am using to launch the app

'use strict';

process.env.CONFIG_DIR = __dirname + '/definitions/catapi';
process.env.NODE_ENV = 'production';
process.env.PORT = 3333;

const microgateway = require('./node_modules/microgateway/lib/microgw');

microgateway.start(process.env.PORT);

lkappeler avatar Aug 09 '17 14:08 lkappeler

Same issue for me too. Is there any solution? It'll be helpfull.

GeetaKrishnaAdhikari avatar Oct 09 '17 14:10 GeetaKrishnaAdhikari

Is there a resolution to this issue?

chaobeck avatar Oct 31 '17 22:10 chaobeck

which version of microgateway are you using? What node version and npm version and os? There is a new version just published, does it resolve your issue?

smartmouse avatar Nov 02 '17 13:11 smartmouse

@smartmouse Thanks for your answer I do still run into the same problem with the latest package, created a sample projet to reproduce the error

Node: 8.9 OS: ubuntu (did not retest but the same happend on my macbook in august)

lkappeler avatar Nov 02 '17 15:11 lkappeler

Thanks for the sample project. I can still reproduce your error with node 6.x and mac OSx.

:microgateway-test-master smartmouse$ node index.js 
Error: not able to perform the handshake with APIM, error: [Error: can not load default private key]
vi index.js

I think the reason why it works when you git clone vs when you are npm installing it, could be some config files and mock-apim-server are included and loaded properly when are loaded automatically in the git clone.

I will need to check with the developers on what could be the root cause .

But you still should be able to request the api, still should be functional regardless of the error.

smartmouse avatar Nov 03 '17 02:11 smartmouse