Deploy failed with status 400

I am trying to deploy Java sample proxy but it always failed with status 400. Please let me know if i am missing some configuration.

Writing ../java-cookbook\buildsetup.sh to .\buildsetup.sh
Writing ../java-cookbook\deploy.sh to .\deploy.sh
Writing ../java-cookbook\invoke.sh to .\invoke.sh
Writing ../java-cookbook\README.md to .\README.md
Writing ../java-cookbook\apiproxy\java-cookbook.xml to apiproxy\java-cookbook.xml
Writing ../java-cookbook\apiproxy\policies\responseUppercase.xml to apiproxy\policies\responseUppercase.xml
Writing ../java-cookbook\apiproxy\proxies\default.xml to apiproxy\proxies\default.xml
Writing ../java-cookbook\apiproxy\resources\java\edge-custom-policy-java-cookbook.jar to apiproxy\resources\java\edge-custom-policy-java-cookbook.jar
Writing ../java-cookbook\apiproxy\resources\java\ResponseUppercase.jar to apiproxy\resources\java\ResponseUppercase.jar
Writing ../java-cookbook\apiproxy\targets\default.xml to apiproxy\targets\default.xml
Writing ../java-cookbook\callout\pom.xml to callout\pom.xml
Writing ../java-cookbook\callout\src\main\java\ResponseUppercase.java to callout\src\main\java\ResponseUppercase.java
Writing ../java-cookbook\callout\target\edge-custom-policy-java-cookbook.jar to callout\target\edge-custom-policy-java-cookbook.jar
Writing ../java-cookbook\callout\target\classes\com\apigeesample\ResponseUppercase.class to callout\target\classes\com\apigeesample\ResponseUppercase.class
Writing ../java-cookbook\callout\target\lib\commons-lang-2.6.jar to callout\target\lib\commons-lang-2.6.jar
Writing ../java-cookbook\callout\target\lib\expressions-1.0.0.jar to callout\target\lib\expressions-1.0.0.jar
Writing ../java-cookbook\callout\target\lib\message-flow-1.0.0.jar to callout\target\lib\message-flow-1.0.0.jar
Writing ../java-cookbook\callout\target\lib\slf4j-api-1.6.1.jar to callout\target\lib\slf4j-api-1.6.1.jar
Writing ../java-cookbook\javadocs-javacallout\README.md to javadocs-javacallout\README.md
Writing ../java-cookbook\lib\expressions-1.0.0.jar to lib\expressions-1.0.0.jar
Writing ../java-cookbook\lib\message-flow-1.0.0.jar to lib\message-flow-1.0.0.jar
Writing ../java-cookbook\lib\README.md to lib\README.md
Imported new proxy version 3
Deploy failed with status 400:


If 'State: deployed', then your API Proxy is ready to be invoked.
Run 'invoke.sh'



0 6 607
6 REPLIES 6

Hi @Faij Ahmad -

unfortunately the log you've provided doesn't give a clear explanation of why the deployment failed.

Deploying from a command line tool involves sending a secured API request to the Administrative API for Apigee Edge. The log file indicates that Apigee Edge responded with a 400, which translates to "Bad Request". But the log file doesn't provide more information than that.

All we know is that the deployment failed.

One thing you can try - retry the deployment, using the Administrative UI. Login to your org via apigee.com, navigate to the proxy in question, then deploy it with the dropdown button. If that works, then you can conclude that the deployment problem was a transient one, an you can just continue working. If the deployment fails again, then there is something else going on, and I don't know how you could diagnose or troubleshoot it.

You can also try the deploy.sh script again, with shell-script tracing enabled. like this:

bash -x deploy.sh 

This won't fix the error, but it might give you more insight into what is happening when the error occurs.

Really I would like to see a curl -i output. I suppose that deploy script is doing a curl command to dpeloy the proxy, and I would like to see the exact payload of the 400 response being send back from apigee Edge. if you can edit the deploy.sh script to make that happen, it would be helpful .

Yes. When i go back to apigee.com and try to deploy , it works fine. I tried again with

bash -x deploy.sh  

but same result. proxy is successfully imported with new version but deployment failed.

I will check what i can do with with deploy.sh to give more informatio about deployement error.

One this i noticed that deployment path seems have basepath wrong showing as "C:/Program Files/Git"

/v1/organizations/xxxxxxx-eval/apis/java-cookbook/deployments?action=deploy&env=test&revision=7&basepath=C:/Program Files/Git

though the basepath in deploy.py is defined as BasePath = '/'

ahh, yes, good sleuthing ! That script is obviously not working properly on Windows. The basepath ought to be the basepath of the proxy itself, which should be... / .

just slash.

not c:/Program Files

!!!!

I will try to figure out why its taking basepath as "C:/Program Files/Git" . Thanks for you help @DinoChiesa-at-Google. Will post again once found the issue.