Deployment error when trying to deploy API proxy samples from apigee

Not applicable

Hi,

I am getting started with this.

I am trying to use the deploy_all.sh script in the API proxy samples. It was able to successfully import everything but it threw and deployment error. Please advise.

Here are the excerpts from the logs:

Deploying all samples to test using zzz@zzz.com and zzz Creating caches { "code" : "messaging.config.beans.CacheAlreadyExists", "message" : "Cache oauth-token-cache already exists in environment test", "contexts" : [ ] }{ "code" : "messaging.config.beans.CacheAlreadyExists", "message" : "Cache paginationCache already exists in environment test", "contexts" : [ ] }Writing images\postman-oauth.png to .\postman-oauth.png Import failed to /v1/organizations/ritwik-chatterjee/apis?action=import&name=images with s tatus 400: { "code" : "messaging.config.beans.InvalidBundle", "message" : "Bundle is invalid. Unable to read/find APIProxy contents", "contexts" : [ ] }

Writing xmltojson\deploy.sh to .\deploy.sh Writing xmltojson\invoke.sh to .\invoke.sh Writing xmltojson\README.md to .\README.md Writing xmltojson\apiproxy\xmltojson.xml to apiproxy\xmltojson.xml Writing xmltojson\apiproxy\policies\jsontoxml.xml to apiproxy\policies\jsontoxml.xml Writing xmltojson\apiproxy\policies\xmltojson.xml to apiproxy\policies\xmltojson.xml Writing xmltojson\apiproxy\proxies\default.xml to apiproxy\proxies\default.xml Writing xmltojson\apiproxy\targets\default.xml to apiproxy\targets\default.xml Imported new proxy version 1 Deploy failed with status 400: Deployment complete. Sample API proxies are deployed to the test environment in the organi zation ritwik-chatterjee Login to enterprise.apigee.com to view and interact with the sample API proxies To invoke the samples, run invoke.sh found in each sample's directory in this distribution . For OAuth, you need to run setup.sh in /setup/provisioning directory to install sample API products, developers and apps in your org. Do you want to run now? ([yes]/no): no Make sure you provision the ApiProducts and Developers, before testing Deployment Completed

0 4 3,333
4 REPLIES 4

adas
New Member

@ritwik_chatterjee This error is being thrown because the cache resource "oauth-token-cache" already exists in the "test" environment for your org. You can simply login to the UI and follow the below steps to delete the cache resource:

- Login

- Go to APIs>Environment Properties

- Select environment "test" and click Delete for the cache resource called oauth-token-cache

After this you can re-run your script it should work. You can also deploy the cache resource using a management api call:

curl -v https://api.enterprise.apigee.com/v1/o/{org}/e/test/caches/oauth-token-cache -X DELETE -H "Authorization: {Base64EncodedCredentials}"

Not applicable

Realize that there are other failures as well:

Import failed to /v1/organizations/ritwik-chatterjee/apis?action=import&name=oauth-advanced with status 400: { "code" : "messaging.config.beans.InvalidBundle", "message" : "Bundle is invalid. Unable to read/find APIProxy contents", "contexts" : [ ] }

I understand this might be a totally different error. But would still like to understand where did things go wrong.

This is the first time I am trying to import so nothing existing.

Not applicable

Hi @arghya das

I tried following your instructions and deleted the "oauth-token-cache", but it still gives me the same error.

Now I would also need help in another problem. When I reran the script, it marked the uploaded proxies as version 2 - which was undesirable. How can I undo what I imported just now?

Latest error logs:

Deploying all samples to test using ritwik_chatterjee@infosys.com and ritwik-chatterjee Creating caches { "compression" : { "minimumSizeInKB" : 1024 }, "description" : "OAuth token cache", "diskSizeInMB" : 0, "distributed" : true, "expirySettings" : { "timeOfDay" : { "value" : "00:00:00" }, "valuesNull" : false }, "inMemorySizeInKB" : 0, "maxElementsInMemory" : 100, "maxElementsOnDisk" : 1000, "name" : "oauth-token-cache", "overflowToDisk" : true, "persistent" : false }{ "code" : "messaging.config.beans.CacheAlreadyExists", "message" : "Cache paginationCache already exists in environment test", "contexts" : [ ] }Writing images\postman-oauth.png to .\postman-oauth.png Import failed to /v1/organizations/ritwik-chatterjee/apis?action=import&name=images with s tatus 400: { "code" : "messaging.config.beans.InvalidBundle", "message" : "Bundle is invalid. Unable to read/find APIProxy contents", "contexts" : [ ] }

Writing xmltojson\deploy.sh to .\deploy.sh Writing xmltojson\invoke.sh to .\invoke.sh Writing xmltojson\README.md to .\README.md Writing xmltojson\apiproxy\xmltojson.xml to apiproxy\xmltojson.xml Writing xmltojson\apiproxy\policies\jsontoxml.xml to apiproxy\policies\jsontoxml.xml Writing xmltojson\apiproxy\policies\xmltojson.xml to apiproxy\policies\xmltojson.xml Writing xmltojson\apiproxy\proxies\default.xml to apiproxy\proxies\default.xml Writing xmltojson\apiproxy\targets\default.xml to apiproxy\targets\default.xml Imported new proxy version 2 Deploy failed with status 400:

adas
New Member

@ritwik_chatterjee This time its complaining for a different cache resource. Can you delete all the cache resources in your test environment from the UI or using the apis and then try again.

Regarding the other question about versions, every time you import a proxy it auto increments the revision number. The concept of importing to an existing revision doesn't exist in apigee because it would have consistency and reliability issues. The idea is to import new revision every time, because the previous revision might be deployed to your production environment which might be serving real time traffic. If you want to keep the same revision number, you can delete the current revisions or delete the apiproxy altogether, but like I already said for a production system this is not advisable.