apigee / apigeetool-node Goto Github PK
View Code? Open in Web Editor NEW"apigeetool" implementation in Node.js for managing Apigee Edge apps and proxies
License: MIT License
"apigeetool" implementation in Node.js for managing Apigee Edge apps and proxies
License: MIT License
Hi all
We are using apigeetool to deploy our bundles via executing them from grunt shell.
We have 3 proxy files under /proxies folder:
When using the latest version of apigeetool (0.6.1), we realised that none of the proxy files are imported into Apigee. Here is the full log:
Running "shell:deploy" (shell) task
deployproxy: {"debug":true,"verbose":true,"username":"email-address-for-deployment","password":{},"organization":"org-here","environments":"intg","api":"b2b-otaxml","directory":".","baseuri":"https://api.enterprise.apigee.com","asyncLimit":4}
Resolve NPM modules = false
Going to create revision 205 of API b2b-otaxml
Calling https://api.enterprise.apigee.com/v1/o/org-here/apis?action=import&validate=false&name=b2b-otaxml
Creating revision 205 of API b2b-otaxml
Uploading jsc resource AuthorizeIpAddress.js
Uploading jsc resource ConvertConfigurationToJson.js
Uploading jsc resource ExtractConfigurationVariables.js
Uploading jsc resource ExtractInvalidateCacheRequestVariables.js
Uploading jsc resource ModifyAvailabilityCacheResponse.js
Uploading jsc resource logglyDirect.js
Uploading node resource Gruntfile.js
Uploading node resource api/controllers/fitController.js
Uploading node resource api/controllers/statusController.js
Uploading node resource api/converters/availabilityConverter.js
Uploading node resource api/converters/cancellationConverter.js
Uploading node resource api/converters/fetchReservationConverter.js
Uploading node resource api/converters/reservationConverter.js
Uploading node resource api/handlers/invalidRequestHandler.js
Uploading node resource api/handlers/otaAvailabilityRequestHandler.js
Uploading node resource api/handlers/otaCancellationRequestHandler.js
Uploading node resource api/handlers/otaFetchReservationRequestHandler.js
Uploading node resource api/handlers/otaHandlers.js
Uploading node resource api/handlers/otaReservationHandler.js
Uploading node resource api/handlers/owsFetchReservationRequestHandler.js
Uploading node resource api/handlers/unacceptableRequestHandler.js
Uploading node resource api/helpers/cheerio.js
Uploading node resource api/helpers/config.js
Uploading node resource api/helpers/context.js
Uploading node resource api/helpers/librato.js
Uploading node resource api/helpers/logger.js
Uploading node resource api/helpers/loggly.js
Uploading node resource api/helpers/ows.js
Uploading node resource api/helpers/owsParams.js
Uploading node resource api/helpers/owsRequest.js
Uploading node resource api/helpers/resourceRequest.js
Uploading node resource api/helpers/template.js
Uploading node resource api/parsers/availabilityResponseParser.js
Uploading node resource api/parsers/cancellationResponseParser.js
Uploading node resource api/parsers/fetchReservationResponseParser.js
Uploading node resource api/parsers/fetchRoomResponseParser.js
Uploading node resource api/parsers/headerResponseParser.js
Uploading node resource api/parsers/otaAvailabilityRequestParser.js
Uploading node resource api/parsers/otaCancellationRequestParser.js
Uploading node resource api/parsers/otaFetchReservationRequestParser.js
Uploading node resource api/parsers/otaReservationRequestParser.js
Uploading node resource api/parsers/reservationResponseParser.js
Uploading node resource api/templates/availability.request.ows.xml
Uploading node resource api/templates/availability.response.ota.xml
Uploading node resource api/templates/cancellation.request.ows.xml
Uploading node resource api/templates/cancellation.response.ota.xml
Uploading node resource api/templates/fetch.reservation.request.ows.xml
Uploading node resource api/templates/fetch.reservation.response.ota.xml
Uploading node resource api/templates/fetchRoom.request.ows.xml
Uploading node resource api/templates/reservation.request.ows.xml
Uploading node resource api/templates/reservation.response.ota.xml
Uploading node resource api/validators/countryValidator.js
Uploading node resource api/validators/otaFetchReservationValidator.js
Uploading node resource app.js
Uploading node resource config/non-prod.json
Uploading node resource config/prod.json
Uploading node resource node_modules_apickli.zip
Uploading node resource node_modules_async.zip
Uploading node resource node_modules_builder-builder.zip
Uploading node resource node_modules_body-parser.zip
Uploading node resource node_modules_csvtojson.zip
Uploading node resource node_modules_del.zip
Uploading node resource node_modules_cheerio.zip
Uploading node resource node_modules_express.zip
Uploading node resource node_modules_i18n-iso-countries.zip
Uploading node resource node_modules_handlebars.zip
Uploading node resource node_modules_express-winston.zip
Uploading node resource node_modules_jstoxml.zip
Uploading node resource node_modules_librato-node.zip
Uploading node resource node_modules_mkdirp.zip
Uploading node resource node_modules_moment-range.zip
Uploading node resource node_modules_moment.zip
Uploading node resource node_modules_pretty-data.zip
Uploading node resource node_modules_nconf.zip
Uploading node resource node_modules_require-dir.zip
Uploading node resource node_modules_loggly.zip
Uploading node resource node_modules_shortid.zip
Uploading node resource node_modules_sinon.zip
Uploading node resource node_modules_underscore.zip
Uploading node resource node_modules_underscore.string.zip
Uploading node resource node_modules_winston.zip
Uploading node resource package.json
Uploading node resource node_modules_request.zip
Uploading node resource node_modules_winston-loggly.zip
Uploading policy AssignMessage.404.xml
Uploading policy AssignMessage.InvalidApiKeyForGivenResource.xml
Uploading policy AssignMessage.PutVariableValuesToResponseHeaders.xml
Uploading policy AssignMessage.ReturnStatusResponse.xml
Uploading policy AssignMessage.Set500ErrorVariables.xml
Uploading policy AssignMessage.SetApiKeyNotSuppliedErrorVariables.xml
Uploading policy AssignMessage.SetApigeeAuthenticationErrorVariables.xml
Uploading policy AssignMessage.SetDefaultContentType.xml
Uploading policy AssignMessage.SetIPAccessErrorVariables.xml
Uploading policy AssignMessage.SetInvalidApiKeyErrorVariables.xml
Uploading policy AssignMessage.SetQuotaErrorVariables.xml
Uploading policy AssignMessage.SetQuotaInfo.xml
Uploading policy AssignMessage.SetRequestorIdErrorVariables.xml
Uploading policy AssignMessage.SetSpikeErrorVariables.xml
Uploading policy AssignMessage.SetXmlValidationErrorVariables.xml
Uploading policy ExtractVariables.GetAvailabilityRequestVariables.xml
Uploading policy ExtractVariables.GetAvailabilityResponseVariables.xml
Uploading policy ExtractVariables.GetCancellationRequestVariables.xml
Uploading policy ExtractVariables.GetCancellationResponseVariables.xml
Uploading policy ExtractVariables.GetRequestMessageType.xml
Uploading policy ExtractVariables.GetReservationRequestVariables.xml
Uploading policy ExtractVariables.GetReservationResponseVariables.xml
Uploading policy InvalidateCache.AvailabilityResponse.xml
Uploading policy JavaScript.AuthorizeIpAddress.xml
Uploading policy JavaScript.ConvertConfigurationToJson.xml
Uploading policy JavaScript.ExtractConfigurationVariables.xml
Uploading policy JavaScript.ExtractInvalidateCacheRequestVariables.xml
Uploading policy JavaScript.ModifyAvailabilityCacheResponse.xml
Uploading policy JavaScript.SendToLoggly.xml
Uploading policy KeyValueMap.GetApiConfiguration.xml
Uploading policy LookupCache.GetApiConfiguration.xml
Uploading policy MessageValidation.Xml.xml
Uploading policy PopulateCache.ApiConfiguration.xml
Uploading policy Quota.HourlyApp.xml
Uploading policy RaiseFault.GoToFaultRules.xml
Uploading policy RaiseFault.Xml.xml
Uploading policy ResetQuota.HourlyApp.xml
Uploading policy ResponseCache.AvailabilityResponse.xml
Uploading policy ServiceCallout.AuthenticateToApigee.xml
Uploading policy SpikeArrest.Global.xml
Uploading policy StatisticsCollector.SetCustomData.xml
Uploading policy VerifyApiKey.ValidateAppId.xml
Uploading target default
Deploying revision 205 of b2b-otaxml to intg
Going to POST to https://api.enterprise.apigee.com/v1/o/org-here/e/intg/apis/b2b-otaxml/revisions/205/deployments
Going go send command action=deploy&override=true&delay=60
Deployment on intg result: "{\n \"code\" : \"distribution.NoProxiesToDeploy\",\n \"message\" : \"No proxies available in apiproxy b2b-otaxml and revision 205. At least one proxy required to deploy\",\n \"contexts\" : [ ]\n}"
Error: No proxies available in apiproxy b2b-otaxml and revision 205. At least one proxy required to deploy
Error: No proxies available in apiproxy b2b-otaxml and revision 205. At least one proxy required to deploy
at Request._callback (/home/rof/.nvm/v0.10.36/lib/node_modules/apigeetool/lib/commands/deployproxy.js:652:12)
at Request.self.callback (/home/rof/.nvm/v0.10.36/lib/node_modules/apigeetool/node_modules/request/request.js:198:22)
at Request.emit (events.js:98:17)
at Request.<anonymous> (/home/rof/.nvm/v0.10.36/lib/node_modules/apigeetool/node_modules/request/request.js:1082:10)
at Request.emit (events.js:117:20)
at IncomingMessage.<anonymous> (/home/rof/.nvm/v0.10.36/lib/node_modules/apigeetool/node_modules/request/request.js:1009:12)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16
at process._tickCallback (node.js:442:13)
Warning: Command failed: Deployment on intg result: "{\n \"code\" : \"distribution.NoProxiesToDeploy\",\n \"message\" : \"No proxies available in apiproxy b2b-otaxml and revision 205. At least one proxy required to deploy\",\n \"contexts\" : [ ]\n}"
Error: No proxies available in apiproxy b2b-otaxml and revision 205. At least one proxy required to deploy
Error: No proxies available in apiproxy b2b-otaxml and revision 205. At least one proxy required to deploy
at Request._callback (/home/rof/.nvm/v0.10.36/lib/node_modules/apigeetool/lib/commands/deployproxy.js:652:12)
at Request.self.callback (/home/rof/.nvm/v0.10.36/lib/node_modules/apigeetool/node_modules/request/request.js:198:22)
at Request.emit (events.js:98:17)
at Request.<anonymous> (/home/rof/.nvm/v0.10.36/lib/node_modules/apigeetool/node_modules/request/request.js:1082:10)
at Request.emit (events.js:117:20)
at IncomingMessage.<anonymous> (/home/rof/.nvm/v0.10.36/lib/node_modules/apigeetool/node_modules/request/request.js:1009:12)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16
at process._tickCallback (node.js:442:13)
� Use --force to continue.
Have a look between these two lines - no proxy files:
Uploading target default
Deploying revision 205 of b2b-otaxml to intg
When I force our CI tool to revert to 0.5.4 of apigeetool, the whole build works fine (I haven't tried the versions in between):
Uploading target default
Uploading proxy admin
Uploading proxy default
Uploading proxy monitoring
Deploying revision 206 of b2b-otaxml to intg
Haven't had time to check the code myself yet.
Please remove the requirement for the main script to reside in the top-level directory. This is unnecessary, and it forces me to adopt your directory structure for my app. For example, when i use -m .src/app.js
, I get the following error:
Error: Main script file ./src/app.js must be in the top level directory
Here's how I worked around the problem:
-m app.js
ln -s .src/app.js app.js
Then everything works properly.
I consider this to be a defect. I don't want to use Apigee's directory structure, nor do I want it to influence my directory structure. Please remove the requirement that the main script must reside in the top-level directory structure. It will work just fine.
Edge Cloud
I am able to recreate the issue
Error: KeyValueMap Operation CreateKeyValueMapEntry is not supported for the organization <org_name>
[CAN YOU REPRODUCE IN A TEST ORG?]
YES
[STEPS TO REPRODUCE]
Here is the snapshot. Where it passed are all CPS orgs and where it failed are non-CPS
phanim-macbookpro:~ phanim$ apigeetool addEntryToKVM -u -o <org_name_1> -e dev --mapName kvmap --entryName test1 --entryValue value1
Password: *********
Error: KeyValueMap Operation CreateKeyValueMapEntry is not supported for the organization <org_name>
phanim-macbookpro:~ phanim$ apigeetool addEntryToKVM -u -o <org_name_2> -e test --mapName testKVM --entryName phani_test_1 --entryValue value1
Password: *********
Error: KeyValueMap Operation CreateKeyValueMapEntry is not supported for the organization <org_name_2>
phanim-macbookpro:~ phanim$ apigeetool addEntryToKVM -u -o <org_name_3> -e test --mapName test --entryName phani_test_1 --entryValue value1
Password: *********
{"name":"phani_test_1","value":"value1"}
phanim-macbookpro:~ phanim$ apigeetool addEntryToKVM -u -o <org_name_4> -e test --mapName test --entryName phani_test_1 --entryValue value1
Password: *********
{"name":"phani_test_1","value":"value1"}
phanim-macbookpro:~ phanim$ apigeetool addEntryToKVM -u -o <org_name_5> -e stage --mapName test --entryName phani_test_1 --entryValue value1
Password: *********
Error: KeyValueMap Operation CreateKeyValueMapEntry is not supported for the organization <org_name_5>
[ADDITIONAL DETAILS, LINKS TO LOGS, DUMPS, SCREENSHOTS, ETC]
I think, the apigeeTool is using CPS based API
Just looked into Apigee Tool code
https://github.com/apigee/apigeetool-node/blob/master/lib/commands/addEntryToKVM.js
The request URL that is being formed is
uri = util.format('%s/v1/o/%s/e/%s/keyvaluemaps/%s/entries', opts.baseuri, opts.organization, opts.environment, opts.mapName);
It is a CPS request so fails in non-CPS
Do we fix code in ApigeeTool?
We have our own instance of Apigee and when trying to use our SSL endpoint (base URL) with apigeetool, I get:
Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE
at SecurePair.<anonymous> (tls.js:1380:32)
at SecurePair.emit (events.js:92:17)
at SecurePair.maybeInitFinished (tls.js:979:10)
at CleartextStream.read [as _read] (tls.js:471:13)
at CleartextStream.Readable.read (_stream_readable.js:340:10)
at EncryptedStream.write [as _write] (tls.js:368:25)
at doWrite (_stream_writable.js:225:10)
at writeOrBuffer (_stream_writable.js:215:5)
at EncryptedStream.Writable.write (_stream_writable.js:182:11)
at write (_stream_readable.js:601:24)
There should be a way, how to specify the certificate used for validation of the endpoint certificate.
Any ideas how this can be done?
Thanks.
My CI tool just updated the npm package to 0.6.4 and now my deployments are broken because of the message
"Error: Path /myproxy conflicts with existing deployment path for revision 13 of the APIProxy authorization in foo-organization".
When I reverted back to 0.6.3 the deploy worked again, so there is something wrong with the version matching. It could well be that it is broken because of issue #54 . This was also broken for me, so I switched to the --api flag instead of -n.
The command that I ran:
apigeetool deployproxy -u ${bamboo_APIGEE_USERNAME} -p ${bamboo_APIGEE_PASSWORD} -o ${bamboo_APIGEE_ORGANIZATION} -e ${bamboo_APIGEE_ENVIRONMENT} --api $apiname -d .
Using apigeetool 0.6.4 on windows 10 with node v4.6.1 yields interesting results when deployproxy
is called:
I can reproduce this reliably and the new API version, while deployed, does not work until it is undeployed (which undeploys both versions) and redeployed.
The last messages from the deployproxy output are:
Final result: err = null for deployments = [
{
"name":"yep*dev",
"environment":"dev",
"revision":8,
"state":"deployed",
"basePath":"/yep*-dev/v1",
"uris":[
"http://*dev.apigee.net/yep*-dev/v1/yep*-dev/v1",
"https://*dev.apigee.net/yep*-dev/v1/yep*-dev/v1"
]
}]
"yep*-dev" Revision 8
deployed
environment = dev
base path = /yep*-dev/v1
URI = http://*-dev.apigee.net/yep*-dev/v1/yep*-dev/v1
URI = https://*-dev.apigee.net/yep*-dev/v1/yep*-dev/v1
Please note that the API returns basePath
twice in the URIs.
(Originally reported by @antxxxx here: #25.)
When basepath is set in the proxy code - ie. if ProxyEndpoint/HTTPProxyConnection/BasePath is set and you pass basepath into apigeetool, you end up with a messed up deployment. When using this to deploy an already existing proxy, it created the new revision correctly, but when it did the deploy, it did not undeploy the old revision, so we ended up with two revisions deployed to the same environment.
To recreate this - create a new proxy with 2 revisions - both must have basepath set in the proxy
If you use the management api (which is what Apigeetool uses to deploy) ie - POST to https://api.enterprise.apigee.com/v1/organizations/{org_name}/environments/{env_name}/apis/{api_name}/revisions/{revision_number}/deployments
with body
action=deploy&override=true&delay=60&basepath=/v1/weather
Then you end up with both revisions showing as deployed.
If basepath is not set in the proxy, then passing basepath in the management api does work - although then the base bath does not show up on the web interface
If basepath is set in the proxy, then not passing basepath in the management api does work
Hi, Im using A127 as my node.js template for Apigee Node app and im deploying it using apigeetool-node (deploynodeapp command).
Deployment is good but API is having an error("context is not defined") when I tried to use the 'context' variable. Im using it for getting a local variable from the KVM.
I've notice that apigeetool node is deploying under 'node' folder unlike when creating a javascript file, it is under jsc. When I try to create a JS script under jsc folder(using the UI) it has access to the 'context' variable.
Why is that so?
We have our own instance of Apigee and when trying to deploy a node app we do the following:
apigeetool deploynodeapp -u [email protected] -o sdoe -e test -n 'Test Node App 2' -d . -m app.js -b /node2 -v 'default,secure'
But this same option is not available when deploying a proxy:
apigeetool deployproxy -u [email protected] -o sdoe -e test -n example-proxy -d .
you can't do this:
apigeetool deployproxy -u [email protected] -o sdoe -e test -n example-proxy -d . -v 'default,secure'
Any ideas how to overcome this without defining it into the XML code?
Thanks.
Deployment through the node tool fails during the validation of the policy schema when a keystore or target server is added to the service callout policy. When I create a zip of the same proxy bundle and upload it to management UI then it deploys fine.
Please find my keystore configuration in Service callout policy:
<HTTPTargetConnection>
<URL>https://myURL.com</URL>
<SSLInfo>
<Enabled>true</Enabled>
<ClientAuthEnabled>true</ClientAuthEnabled>
<KeyStore>openiam_tls_keystore</KeyStore>
<KeyAlias>openiam_tls_client_cert</KeyAlias>
</SSLInfo>
</HTTPTargetConnection>
I tried to debug the issue and following is my understanding-
Apigee nodetool makes a post call to https://api.enterprise.apigee.com/v1/o//apis//revisions//policies with policy content in body and in response Apigee is throwing back the error:
"{\n \"code\" : \"beans.OtherValidationError\",\n \"message\" : \"Unexpected Validation Error null\",\n \"contexts\" : [ ]\n}"
API to use would be https://api.enterprise.apigee.com/v1/o/$org/e/$env/apis/$apiName/deployments
While deploying proxies having nodejs resource in opts['upload-modules'] = true;
mode. Apigeetool creates multiple zips of different node_modules. eg node_modules_yaml.zip, node_modules_mustache.zip along with these it also creates node_modules.zip
node_modules.zip obviously has all the modules within hence we don't need node_modules_yaml.zip, node_modules_mustache.zip zips or need not create node_modules.zip and retain other zips.
The -n option should be for specifying the "name" of the proxy. This option doesn't work anymore -- when I use "-n" in the command line, it is not recognized. Use of --api does work however. But, apigeetool isn't backward compatible for scripts that used "-n".
Also -- apigeetool -h shows two "-n" options (one for --api and one for --netrc). This should be cleaned up.
May need to install these before tests can run or rewrite the tests a bit, but I don't think they should be checked into git.
https://github.com/apigee/apigeetool-node/blob/master/README.md#deployexistingrevision needs to be removed from GitHub README unless this is some new feature added to the plugin. The same is not available in the npm docs
I can't deploy on Apigee with my package.json
"as is" with the -R
option because the devDependencies that I use (e.g., gulp, etc.) are too large and exceeds the Proxy Bundle limit. As a workaround, I have to do the following:
npm install --production
-U
optionBut this is still a defect. Please fix your deployment tool to use npm install --production
. That way, you're just pulling in the dependencies
from package.json
, and everything works as expected.
Code should be doing the right thing and doing async calls, but it seems that opts.asyncLimit is not being set correctly (or at all).
API that lists deployments (v1/o/$org/e/$env/deployments) lists deployments all states. When state is error which could be because bundle references an invalid virtualhosts, it should not use those virtualhost as part of validation.
Throws Invalid arguments: Error: Unknown argument
Most likely caused by @DinoChiesa #37 as it's using the same alias
This caused our deployments to fail. We've had to work around this by using --api instead of -n.
Documentation is still showing -n as an alias of --api for deploynodeapp
.
Can you please bump to a major version v1? This was a breaking change, but the version bump was done as a patch
Is there any plan to add MFA support for apigeetool?
Today when I create and deploy a proxy to Apigee through the UI, it uses both default
and secure
virtualhosts. Why is the behavior for apigeetool different? I would expect it to always use default
and secure
, though I could override that with a command line param if I wished.
When deploying nodejs applications using apigeetool, all the folders are compressed (zipped) before they are deployed to Edge (the main script is not compressed). Generally speaking, I think it is a great idea when it comes to folders like node_modules. But the command compresses other folders also. for ex: when deploying an a127 project, it compresses the "controllers" folder. When this happens, I lose the ability to make the smallest of edits in Edge. Every edit made outside of Edge will result in a new revision. I wonder if it makes sense to have a file similar to a .npmignore that tells you what files/folders to not zip or perhaps only compress node_modules by default and leave everything else.
/Users/adammagaluk/Software/Edge/apigeetool-node/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js:5
const Hoek = require('hoek');
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/adammagaluk/Software/Edge/apigeetool-node/node_modules/request/node_modules/hawk/lib/index.js:5:33)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
apigeetool deploynodeapp -o -e test -n -m index.js -b -v https_vhost -P
If I remove the parameter -P, the apiproxy uploads correctly, but I need to preserver-policies
Any help?
For optional values such as:
--api -n
--base-path -b
--main -m
that aren't specified via the CLI, add logic to parse package.json and use the values in the api object (if present).
"api": {
"name": "my-api",
"basePath": "/some/basepath",
"main": "app.js"
}
The deploy proxy in remotetests steps takes about 50-60 seconds and sometimes timing out
Proposal
1 - use a simpler proxy with just express - there is no need to include node_modules if its just express, so the bundle size could become significantly smaller and deployment faster
2 - for non-nodejs test, we could use a simpler proxy that does not have nodejs resources - might fasten the tests
I have a proxy which includes JWT creation (from https://github.com/apigee/iloveapis2015-jwt-jwe-jws) and thus includes some JARs, for a total of 2.7mb. When deploying this, it always fails with:
c:>apigeetool deployproxy -p password -u [email protected] -o organisation-name -n proxy-name -k -V -a 50 -i
...
Uploading java resource apigee-edge-callout-jwt-signed-1.0.6.jar
Uploading java resource json-smart-1.3.jar
Uploading java resource nimbus-jose-jwt-3.10.jar
Uploading java resource Utils-Callout.jar
...
Uploading policy VerifyAPIKey.xml
Error: Error uploading policy: 500
Error: Error uploading policy: 500
at Request._callback (C:..path..npm\node_modules\apigeetool\lib\commands\deployproxy.js:397:18)
at Request.self.callback (C:..path..npm\node_modules\apigeetool\node_modules\request\request.js:188:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request. (C:..path..npm\node_modules\apigeetool\node_modules\request\request.js:1171:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage. (C:..path..npm\node_modules\apigeetool\node_modules\request\request.js:1091:12)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:91:20)
Uploading smaller proxies does work well.
Uploading a zip of the proxy via the Apigee UI works well (1-2 minutes).
Having looked at the Node source code, and tried uploading to a new proxy name, I'm expecting the uploader to make a zip file:
var zipBuf = ziputils.makeOneFileZip(ProxyBase, rootEntryName, rootDoc);
and upload that; however, it seems to upload the resources, policies, proxies and targets one by one.
Has anyone seen this behavior ?
Freddie Vander Elst
Background:
Create 2 users (user 1 and user 2) in custom role. The custom role has CREATE and VIEW abilities on all API proxies.
+Scenario 1 (this works as expected):+
+Scenario 2 (this fails)+
I think it is a bad user experience if the UI takes care of creating this entry in the custom role(prob via an additional MS API call), but Apigeetool does not. IMO these 2 tools should be at parity for this feature since both are officially supported by Apigee.
It would be great if I could set my apigeetool config properties, like username
and org
so that I didn't have to supply them with every request. These might be configured using something like apigeetool config user [email protected]
and would include a config listing.
@theganyo or who else this concerns
It looks like the -V
or --debug -D
flags don't return errors from the API itself. Here's what I'm getting back:
Please report a bug if this causes problems.
Error: Error: Error uploading policy: 400
Error: Error uploading policy: 400
at Request._callback (/usr/local/lib/node_modules/apigeetool/lib/commands/deployproxy.js:376:18)
at Request.self.callback (/usr/local/lib/node_modules/apigeetool/node_modules/request/request.js:123:22)
at emitTwo (events.js:87:13)
at Request.emit (events.js:172:7)
at Request.<anonymous> (/usr/local/lib/node_modules/apigeetool/node_modules/request/request.js:1047:14)
at emitOne (events.js:82:20)
at Request.emit (events.js:169:7)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/apigeetool/node_modules/request/request.js:998:12)
at emitNone (events.js:72:20)
at IncomingMessage.emit (events.js:166:7)
Is there an option I'm missing here? At first glance, the error messages don't seem to be printed out the console:
apigeetool-node/lib/commands/deployproxy.js
Lines 369 to 377 in 2198cff
Though I haven't done a deep-dive into the code yet. Let me know how I can help. Thanks!
Hi,
Does apigeetool support invoking Organization key/value maps APIs (Add, Get etc)?
Thanks.
$ apigeetool ... deploynodeapp -V -d . -e test -n mongo-nodejs1 -o merck -m api-mongo.js -b /v1/mongodb -i
API mongo-nodejs1 does not exist. Going to create revision 1
Creating revision 1 of API mongo-nodejs1
Uploading resource README.txt
Uploading resource api-mongo.js
Uploading resource node_modules.zip
Uploading resource package.json
Creating the target endpoint
Creating the proxy endpoint
Not deploying the proxy right now
TypeError: Cannot read property 'aPIProxy' of undefined
at Object.module.exports.parseDeploymentResult (/usr/local/lib/node_modules/apigeetool/lib/commands/parsedeployments.js:42:9)
at /usr/local/lib/node_modules/apigeetool/lib/commands/deploynodeapp.js:120:43
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:254:17
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:157:25
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:251:21
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:615:34
at deployProxy (/usr/local/lib/node_modules/apigeetool/lib/commands/deploynodeapp.js:449:5)
at async.series.deployResult (/usr/local/lib/node_modules/apigeetool/lib/commands/deploynodeapp.js:108:7)
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:610:21
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:249:17
Is there a way to use apigeetool to deploy a particular revision of the app to an environment? I know how to use deploynodeapp to deploy to an environment, but I would like to propagate an existing revision of the app from test to prod. Is that possible using apigeetool?
if you are inside the "apiproxy" folder or if you have renamed to something else after download, it will return this "Proxy base director /absolute/path/to/package does not exist error". The error is very misleading, could have been more clear by indicating the "apiproxy" folder does not exist for this particular scenario.
See https://community.apigee.com/questions/51518/apigeetool-deployproxy-getting-proxy-base-director.html
The recent update to Request (2.82.0) specifies "hawk": "~6.0.2" in its dependencies.
Request has marked 2.82.0 as compatible with "request": "^2.63.0" as specified by this project's package.json
The recent updates to Hawk will not work with Node < 4. The update makes Apigeetool incompatible with Node 0.10.32
package.json allows for defining the default start command (reference).
…
"scripts": {
"start": "node app.js"
}
…
Keep the -m for the CLI to declare (or override) the main script to start, but if the declaration is in the package.json, Edge (or apigeetool) should use it.
The new feature to read credentials from a .netrc file is potentially useful; however, the format of the .netrc file is not documented in the read me. What do the contents of this file look like, and is it placed in the home directory? Would a copy in the cwd override a home directory copy?
When running deployproxy on a proxy, it creates zipped copies of sub directories in the resources/node directory and uploads them. If there is already a file with that name in the directory (say you are editing an export), then it will upload both of them and error with a 409.
This should either be caught earlier, or the zip should be favored or ignored. At the very least, a specific error should be thrown.
Hi,
I would like to ask for a feature request.
Since it is too tedious to type everything in a single command like -o org -e environment
Also it is hard to maintain.
Can there be a file like '.apigee' where apigeetool node reads file for the options?
You may refer to AWS-cli, it can have many profiles with different environment setup.
As per the docs - the -r argument is optional for fetchproxy but when we try to run the command without the argument, it fails with the following error
$ apigeetool fetchproxy -u [email protected] -o saisarantest -n currency-v1
Error: org, api and revision must all be specified! {"username":"[email protected]","organization":"saisarantest","api":"currency-v1","interactive":true,"baseuri":"https://api.enterprise.apigee.com","asynclimit":4,"password":{}}
I wanted to query whether it would be possible to setup config files within our projects to specify common options such as base path etc which we could store in git.
This would make deployments much easier, and by requiring each person to have their username and password as a environment variable, it'd mitigate any leaking of sensitive data into git.
Obviously I could create a wrapper tool which performs this task and then simply builds up the command to execute, but it would be nicer for this functionality to be built into the tool itself.
Perhaps some sort of . rc
file which can be automatically read if it exists, which sets default values such as baseuri etc, but can still be overridden directly in the command via the current flags.
I'm happy to open a PR implementing this, but file name and format need discussing first.
We would like to use the agile approach of developing APIs. This means, we start small, with several features and then we constantly improve the API by adding more and more features.
In case of a Node.js base proxy, this means developing the API locally and repeatedly deploying it to Apigee. We use the deploynodeapp
command of apigeetool. It is intended to be used for initial deployment. And this is actually our problem. If I deploy the Node.js app and add some Apigee policies to the proxy, next time I re-deploy the Node.js app, the policies get overwritten.
We need a way, how to repeatedly deploy a Node.js app without having to re-create all the policies we need. Or what is the proper way, how to do this?
I suppose I can use the deployproxy
command, but first I need to zip all Node.js folders the way Apigee can consume them. Maybe there could be a parameter to the deployproxy
command, which will make sure, that the ZIP files are created before the proxy is deployed.
This isn't a defect in apigeetool, but I'm unable to use it behind my corporate firewall.
As long as I'm outside the firewall, apigeetool works properly.
I've tried the following, and no joy:
npm config set registry="http://registry.npmjs.org/"
npm config set strict-ssl false
Do you have any ideas for helping node get through/past the firewall?
Thanks.
When using the import-only
option, the results for deployProxy
are null
or empty. It would be good to have it return basic information i.e. name, revision, state as requested by #92
When running deployproxy with -i (just upload a new revision, don't deploy it), it works, but throws an error (shown below). It seems to be still attempting to parse the deployment message, even though there isn't one.
+++++++++++++++++++++++++++++
Not deploying the proxy right now
TypeError: Cannot read property 'aPIProxy' of undefined
at Object.module.exports.parseDeploymentResult (/usr/local/lib/node_modules/apigeetool/lib/commands/parsedeployments.js:42:9)
at /usr/local/lib/node_modules/apigeetool/lib/commands/deployproxy.js:116:43
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:254:17
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:157:25
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:251:21
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:615:34
at deployProxy (/usr/local/lib/node_modules/apigeetool/lib/commands/deployproxy.js:576:5)
at async.series.deployResult (/usr/local/lib/node_modules/apigeetool/lib/commands/deployproxy.js:104:7)
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:610:21
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:249:17
For example, like this:
apigeetool deploynodeapp -u [email protected] -o orgname-nonprod -e alpha \
-n 'baasutility' -d . -m app.js -b /v1/baasutility
The result is the APIProxy is deployed but the basepath is set to c:\Program Files (x86)\something
Bogus!
I just installed apigeetool, and so far all the functions have worked fine, except for "fetchproxy". I just ran:
apigeetool fetchproxy -o {org} -e {env} -u {email} -n {proxy} -r 1 -D
and I see:
...
Going to invoke "https://api.enterprise.apigee.com/v1/o/{env}/apis/{proxy}/revisions/1?format=bundle"
...
"-e" is being used for "-o" in the request.
While you can specify multiple virtualhosts at once, like -v secure,default
but you cannot specify multiple environments in this way. It would be handy to have the same pattern, so one could use -e test,prod
to deploy to both proxies at once.
request.get( { uri: uri, encoding: 'binary' }, function (err,res,body) {
if (err) {
cb(err);
} else {
if (opts.debug) {
console.log ( 'Received: ' + res.statusCode + ' the following headers: ' + JSON.stringify(res.headers) );
}
if (res.statusCode !== 200) {
cb(new Error(util.format('Received error %d when fetching proxy: %s',
res.statusCode, body)));
} else {
fs.writeFile(f, body, 'binary', function(err) {
if (err) {
console.log( "Failed to write file: " + f );
console.log( "Error text: " + err );
}
else {
console.log( 'Save file: ' + f );
}
});
}
}
});
Ideally above code should call cb on success...
return cb(err);
//or
return cb(null);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.