Hi,
I am trying to deploy a node app I have using the apigeetool cli. Do I upload all node modules at the same time? If yes, it seems to dump then all in a node file losing the file structure I originally had. I am following this deployment tutorial but something doesn’t seem right? There is also a Bad Gateway happening on some packages and the node modules never get uploaded. Tried multiple times.
http://docs.apigee.com/api-services/content/deploying-standalone-nodejs-app
Thanks!
1 Like
Update: I was able to deploy my node app but without the node_modules attached although using it is useless without the node_modules. So my question remains how to properly add node_modules because the default way is not working for me?
Hmm, I noticed recently that using the Apigee Admin API for “npm install” was not working.
The way I have deployed nodejs apps is:
- perform an npm install locally
- zip up the node_modules folder into node_modules.zip
- remove the node_modules folder
- zip the entire API Proxy bundle
- import THAT zip
This can be done with a tool like pushapi .
or you can do it manually, or write your own mini-script to do the zipping step. Here’s an example.
$ ./ProduceApiProxyZip.sh ~/dev/community-examples/crypto-test
Creating the zip at apiproxy-crypto-test-20170831-164831.zip
zipping the node modules...
Archive: apiproxy-crypto-test-20170831-164831.zip
Length Date Time Name
--------- ---------- ----- ----
0 04-26-2017 11:11 apiproxy/
437 04-26-2017 11:11 apiproxy/crypto-test.xml
0 04-26-2017 11:24 apiproxy/policies/
619 04-26-2017 11:11 apiproxy/policies/AM-CleanResponseHeaders.xml
126 04-26-2017 11:11 apiproxy/policies/JS-MaybeFormatFault.xml
421 04-26-2017 11:11 apiproxy/policies/RF-UnknownRequest.xml
0 04-26-2017 11:24 apiproxy/proxies/
865 04-26-2017 11:24 apiproxy/proxies/default.xml
0 04-26-2017 11:11 apiproxy/resources/
0 04-26-2017 11:11 apiproxy/resources/jsc/
573 04-26-2017 11:11 apiproxy/resources/jsc/maybeFormatFault.js
0 08-31-2017 16:48 apiproxy/resources/node/
2265588 08-31-2017 16:48 apiproxy/resources/node/node_modules.zip
403 04-26-2017 11:15 apiproxy/resources/node/package.json
1520 04-26-2017 11:22 apiproxy/resources/node/testServer.js
0 04-26-2017 11:24 apiproxy/targets/
770 04-26-2017 11:24 apiproxy/targets/default.xml
--------- -------
2271322 17 files
zip: apiproxy-crypto-test-20170831-164831.zip<br>
If you don’t have bash, and you have Windows and Powershell, then you can use the Edge Powershell module to do the same thing.
Import-EdgeApi -Name my-apiproxy-1 -Source c:\my\directory
In the meantime I will look into the failure that you reported.