apigee / apigee-deploy-maven-plugin

Apache License 2.0
80 stars 167 forks source link

Error : Bundle is invalid. Empty bundle. #96

Closed imran9m closed 5 years ago

imran9m commented 6 years ago

Observation - We migrated from 1.1.5 to 1.1.7(and enabled oAuth). During deployment, getting below failure. If I reverted it back to 1.1.5, it works fine(with oAuth as well). Please advise.

02:39:27 Request prepared for the server 
02:39:27  **************************
02:39:27 POST  https://api.enterprise.apigee.com/v1/organizations/myOrg/apis?action=import&name=my-proxy&validate=true
02:39:27 accept: application/json
02:39:27 accept-encoding: gzip
02:39:27 authorization: Bearer [Not shown in log]
02:39:27 content-type: application/octet-stream
02:39:27  [Request body contains data, not shown] 
02:39:27 
02:39:28 [ERROR] 400 Bad Request
02:39:28 {
02:39:28   "code" : "messaging.config.beans.InvalidBundle",
02:39:28   "message" : "Bundle is invalid. Empty bundle",
02:39:28   "contexts" : [ ]
02:39:28 }
02:39:28 [ERROR] 
02:39:28 
02:39:28 
02:39:28 * * * * * * * * * * *
02:39:28 
02:39:28 This deployment could have failed for a variety of reasons.
02:39:28 
02:39:28 
02:39:28 
02:39:28 * * * * * * * * * * *
02:39:28 
02:39:28 
02:39:28 
02:39:28 [INFO] ------------------------------------------------------------------------
02:39:28 [INFO] BUILD FAILURE
02:39:28 [INFO] ------------------------------------------------------------------------
02:39:28 [INFO] Total time: 3.066 s
02:39:28 [INFO] Finished at: 2018-07-27T02:39:28+00:00
02:39:28 [INFO] Final Memory: 27M/384M
02:39:28 [INFO] ------------------------------------------------------------------------
02:39:28 [ERROR] Failed to execute goal io.apigee.build-tools.enterprise4g:apigee-edge-maven-plugin:1.1.7:deploy (default-cli) on project my-proxy: MojoExecutionException: 400 Bad Request
02:39:28 [ERROR] {
02:39:28 [ERROR] "code" : "messaging.config.beans.InvalidBundle",
02:39:28 [ERROR] "message" : "Bundle is invalid. Empty bundle",
02:39:28 [ERROR] "contexts" : [ ]
02:39:28 [ERROR] }
02:39:28 [ERROR] -> [Help 1]
02:39:28 org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.apigee.build-tools.enterprise4g:apigee-edge-maven-plugin:1.1.7:deploy (default-cli) on project my-proxy: 
02:39:28    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
02:39:28    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
02:39:28    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
02:39:28    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
02:39:28    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
02:39:28    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
02:39:28    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
02:39:28    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
02:39:28    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
02:39:28    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
02:39:28    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
02:39:28    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
02:39:28    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
02:39:28    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
02:39:28    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
02:39:28    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
02:39:28    at java.lang.reflect.Method.invoke(Method.java:498)
02:39:28    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
02:39:28    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
02:39:28    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
02:39:28    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
02:39:28 Caused by: org.apache.maven.plugin.MojoExecutionException: 
02:39:28    at io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo.processHelpfulErrorMessage(DeployMojo.java:384)
02:39:28    at io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo.execute(DeployMojo.java:369)
02:39:28    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
02:39:28    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
02:39:28    ... 20 more
02:39:28 Caused by: java.io.IOException: 400 Bad Request
02:39:28 {
02:39:28   "code" : "messaging.config.beans.InvalidBundle",
02:39:28   "message" : "Bundle is invalid. Empty bundle",
02:39:28   "contexts" : [ ]
02:39:28 }
02:39:28    at io.apigee.buildTools.enterprise4g.rest.RestUtil.uploadBundle(RestUtil.java:474)
02:39:28    at io.apigee.buildTools.enterprise4g.rest.RestUtil.uploadBundle(RestUtil.java:422)
02:39:28    at io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo.doImport(DeployMojo.java:158)
02:39:28    at io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo.execute(DeployMojo.java:283)
02:39:28    ... 22 more
02:39:28 [ERROR] 
02:39:28 [ERROR] 
02:39:28 [ERROR] For more information about the errors and possible solutions, please read the following articles:
02:39:28 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
ssvaidyanathan commented 6 years ago

@imran9m - looks like the bundle is invalid. Can you compare the zip file you get in the target directory when you use 1.1.5 and 1.1.7 ? There were no changes done on that part of the code. So please compare and let me know if you see any difference.

Are you changing anything else in the pom along with the version change ?

imran9m commented 6 years ago

@ssvaidyanathan Thanks for the response. There are no changes. Here is a sample repo you can replicate the issue.

Repo - https://github.com/imran9m/helloworld

Steps

  1. Clone above repository and run below maven commands.
    mvn clean package -DprepareBundle=true
    mvn apigee-enterprise:deploy -Pconfigure-bundle,deploy-bundle
  2. Since plugin version is 1.1.5, it should create new revision properly.
  3. Now replace 1.1.5 with 1.1.7 and run the same maven commands again. It should fail with empty bundle error. Note -
  4. If I run below command, it works fine but my requirement is to run like above separately. mvn clean package -DprepareBundle=true apigee-enterprise:deploy -Pconfigure-bundle,deploy-bundle
  5. Please make sure you update org, env, username and password before running them.
imran9m commented 6 years ago

I did little bit of research and was able to resolve the issue with below changes for 1.1.7.

  1. With 1.1.7, there is no zip file being created as configure goal was not executing.
  2. I changed my maven commands to like below and it worked. I had to explicitly provide configure goal.
    mvn clean package -DprepareBundle=true
    mvn apigee-enterprise:configure apigee-enterprise:deploy -Pconfigure-bundle,deploy-bundle
ssvaidyanathan commented 5 years ago

Hi.. Looks like you were missing the configure goal within your pom file. In your sample pom, configure and deploy are in two different profiles. Not sure why you have it set like that. Please refer to the samples in the github for more info. Since this is working as expected, I am closing this issue. If you still feel thats not the case, please reopen