node startup not working as expected in edgemicro

Not applicable

I'm making some headway on the Micro Gateway servers and I want to be able to productionalize this. Does anyone have any luck getting the "node <edgemicro-root-dir>/agent/build/src/index.js" command working when setting EDGEMICRO_KEY and EDGEMICRO_SECRET env variables?

I've set the variables I've started the node server but it doesn't seem to grab the information from the edge install as listed in this document under the "Running in a production environment" heading. If I'm reading that correctly I should be able to set those variables and start it using node or pm2 commands and forego the edgemicro proc start command. Debug doesn't offer any advice as it looks like it just starts without actually getting the information it needs from our on prem install of edge.

Solved Solved
0 3 418
1 ACCEPTED SOLUTION

Hi @Bryant Olson,

I just tried using the env variables and it worked successfully. Here's what I did:

1) Added the variables to my .bash_profile: export EDGEMICRO_KEY=<long string> export EDGEMICRO_SECRET=<long string>

2) In the shell where I am starting Edge Microgateway, I make sure to source the shell profile: source ~\.bash_profile

3) I checked to see that the variables are present:

printenv

4) cd to the agent directory:

cd <edgemicro-root>/agent

5) Finally, I started the agent:

npm start

or

DEBUG=* npm start

or

node ./build/src/index.js

In my case, the agent did start Edge Microgateway, all the config downloaded normally, and I was able to call my API successfully.

Can you get it to work by following these steps? Hope this helps.

Will

View solution in original post

3 REPLIES 3

Hi @Bryant Olson,

I just tried using the env variables and it worked successfully. Here's what I did:

1) Added the variables to my .bash_profile: export EDGEMICRO_KEY=<long string> export EDGEMICRO_SECRET=<long string>

2) In the shell where I am starting Edge Microgateway, I make sure to source the shell profile: source ~\.bash_profile

3) I checked to see that the variables are present:

printenv

4) cd to the agent directory:

cd <edgemicro-root>/agent

5) Finally, I started the agent:

npm start

or

DEBUG=* npm start

or

node ./build/src/index.js

In my case, the agent did start Edge Microgateway, all the config downloaded normally, and I was able to call my API successfully.

Can you get it to work by following these steps? Hope this helps.

Will

BTW, I'm hitting a cloud instance. Not an onprem. I'm not sure why it would make a difference, but if you can't get it to work, then there may be a bug specific to onprem. Also, I'm using apigee-edge-micro-1.1.1.

that did it, I was simply setting the variables as a local variable and not using "export" to set it as an environment variable. simply adding "export" to my script did the trick. Thanks!