uploading image using google cloud end points

132 views
Skip to first unread message

Vivek Kumar

unread,
Mar 23, 2017, 12:37:59 AM3/23/17
to Google Cloud Endpoints
Hi

I am building a ios app using a java framework called MAF.

the requirement is to click pic and analyze it using google vision api. 

The problem is: google cloud end point does not support passing an image (also vision api would require the image accessible either from a google storage bucket or some http URL). 

So, what is the solution in this case?  One way I was thinking as:

1. upload the image to somewhere (not sure where at this point) from my ios using some sort of REST api. This should return me the image url once uploaded.
2. then in my app i will enable another button to say analyze. This can invoke google cloud end point api where i can pass the url returned earlier. The google cloud end point can then invoke vision api and give me data that i can simply return back to ios.


please advise


Wesley Wong

unread,
Mar 27, 2017, 1:34:18 PM3/27/17
to Vivek Kumar, Google Cloud Endpoints
Hi Vivek,

Your solution looks good.

For step 1, you could use Google Cloud Storage:
--
You received this message because you are subscribed to the Google Groups "Google Cloud Endpoints" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-endp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-endpoints/2faefdd7-0585-4022-8c27-05cdf806c274%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vivek Kumar

unread,
Mar 27, 2017, 2:48:11 PM3/27/17
to Wesley Wong, Google Cloud Endpoints
Thank you! 

however deploying the app to flexible env for google app engine fails even with the provided samples.



running:VSKUMAR-mac:getting-started vskumar$ mvn appengine:deploy
gives:

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 2.246 s

[INFO] Finished at: 2017-03-27T00:19:55-07:00

[INFO] Final Memory: 21M/313M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:1.0.0:deploy (default-cli) on project endpoints: Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:1.0.0:deploy failed: Found 'Dockerfile' in the App Engine directory. Please move it to the Docker directory. -> [Help 1]

[ERROR] 



I tried that but then error changed to:

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 2.395 s

[INFO] Finished at: 2017-03-27T00:22:19-07:00

[INFO] Final Memory: 21M/313M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:1.0.0:deploy (default-cli) on project endpoints: Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:1.0.0:deploy failed: Found an unexpected 'Docker' file in the App Engine directory. -> [Help 1]



Vik


Wesley Wong

unread,
Mar 27, 2017, 4:52:24 PM3/27/17
to Vivek Kumar, Google Cloud Endpoints
It looks like there is a bug with the samples. I'm working on correcting this.

In the meantime, please move the following files around so that you can be unblocked:

src/main/appengine
- Dockerfile
- app.yaml
- openapi.yaml

to

src/main/appengine
- app.yaml
src/main/docker
- Dockerfile
src/main/openapi
- openapi.yaml

You should be able to execute "mvn appengine:deploy" now.

I'm still testing this fix, but I wanted to get you going first.

Wesley Wong

unread,
Mar 27, 2017, 5:36:38 PM3/27/17
to Vivek Kumar, Google Cloud Endpoints
And there was also a change needed for the Dockerfile itself.

You can see the GitHub pull request for the details:

Vivek Kumar

unread,
Mar 27, 2017, 6:48:33 PM3/27/17
to Wesley Wong, Google Cloud Endpoints
Done.  and this is the new error i see

[INFO] Total time: 01:09 min

[INFO] Finished at: 2017-03-27T15:44:42-07:00

[INFO] Final Memory: 21M/309M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:1.0.0:deploy (default-cli) on project endpoints: Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:1.0.0:deploy failed: Non zero exit: 1 -> [Help 1]

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:1.0.0:deploy (default-cli) on project endpoints: Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:1.0.0:deploy failed: Non zero exit: 1

at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)

at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)

at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)

at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)

at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)

at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)

at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)

at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)

at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)

at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)

at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)

at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)

at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)

at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)

at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)

at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:1.0.0:deploy failed: Non zero exit: 1

at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)

at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)

... 20 more

Caused by: com.google.cloud.tools.appengine.api.AppEngineException: Non zero exit: 1

at com.google.cloud.tools.appengine.cloudsdk.process.NonZeroExceptionExitListener.onExit(NonZeroExceptionExitListener.java:30)

at com.google.cloud.tools.appengine.cloudsdk.internal.process.DefaultProcessRunner.syncRun(DefaultProcessRunner.java:183)

at com.google.cloud.tools.appengine.cloudsdk.internal.process.DefaultProcessRunner.run(DefaultProcessRunner.java:128)

at com.google.cloud.tools.appengine.cloudsdk.CloudSdk.runAppCommand(CloudSdk.java:130)

at com.google.cloud.tools.appengine.cloudsdk.CloudSdkAppEngineDeployment.deploy(CloudSdkAppEngineDeployment.java:68)

at com.google.cloud.tools.maven.DeployMojo.execute(DeployMojo.java:101)

at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)

... 21 more

[ERROR] 

[ERROR] 

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

Wesley Wong

unread,
Mar 27, 2017, 7:08:09 PM3/27/17
to Vivek Kumar, Google Cloud Endpoints
Hi Vivek,

This new error message doesn't have much information in it that I can make sense of. Let me see if I can figure something out. It might take a little bit. Sorry.

Wesley

Vivek Kumar

unread,
Mar 27, 2017, 7:23:03 PM3/27/17
to Wesley Wong, Google Cloud Endpoints
do u want my project?  i can share it as it has nothing personal at this point.

Vik

Wesley Wong

unread,
Mar 27, 2017, 7:24:48 PM3/27/17
to Vivek Kumar, Google Cloud Endpoints
If you are comfortable doing so, that would help.

Thanks,
Wesley

Vivek Kumar

unread,
Mar 27, 2017, 7:38:18 PM3/27/17
to Wesley Wong, Google Cloud Endpoints

Wesley Wong

unread,
Mar 27, 2017, 7:55:06 PM3/27/17
to Vivek Kumar, Google Cloud Endpoints
Hi Vivek,

Just to be sure, you are still running this from within the java-docs-samples right? Your zip only included the getting-started directory, so I just want to make sure. This is because the getting-started pom.xml references a parent higher up.

If you are running this within java-docs-samples, then the other issue I see is that in app.yaml, you have set the config_id to "[2017-03-27r0]". This should not contain the surrounding "[]". Therefore, it should just be "2017-03-27r0". This might fix your deployment issue.

Also, your zip file contained your JSON key. You will want to delete that key and generate a new one.

Please let me know if that works.

Thanks,
Wesley

Vivek Kumar

unread,
Mar 27, 2017, 8:07:07 PM3/27/17
to Wesley Wong, Google Cloud Endpoints
ok so eliminating the [] in config-id did the trick.  Thanks so much!

Vik

Wesley Wong

unread,
Mar 27, 2017, 8:09:30 PM3/27/17
to Vivek Kumar, Google Cloud Endpoints
Great to know that worked!

Cheers,
Wesley

Vivek Kumar

unread,
Mar 27, 2017, 8:26:00 PM3/27/17
to Wesley Wong, Google Cloud Endpoints
Here is a related issue I am struggling with and dont see answers on google documentation.

Now as i built all this maven way using command line, I would need to use some IDE where i can start my actual development and deploy from the IDE itself. 

Do we have such capability or what is the recommended workflow for devs

Thanks
Vik

Wesley Wong

unread,
Mar 27, 2017, 8:44:40 PM3/27/17
to Vivek Kumar, Google Cloud Endpoints
You can use any IDE you normally use to do Java development. For example, Eclipse, IntelliJ, etc.
Reply all
Reply to author
Forward
0 new messages