IBM / BluePic

WARNING: This repository is no longer maintained :warning: This repository will not be updated. The repository will be kept available in read-only mode.
https://developer.ibm.com/code/patterns
Apache License 2.0
324 stars 67 forks source link

wsk action invoke processImage action doesn't see uploaded Cloudant image IDs #283

Closed iainhouston closed 8 years ago

iainhouston commented 8 years ago

How to determine what's not tying up properly?

wsk action invoke processImage -p imageId <image id> fails saying that error: The requested resource does not exist. even though all the debug sequences generated by ./bluepic.sh --install do work with that image id (with the exception of bluepic/processCallback - but it is not clear to me what are the correct arguments to this wsk. )

The log says nothing at all when I wsk action invoke processImage

The log complains that bluepic/processCallback is

Unable to convert value of type Optional<protocol<>>: 
file Foundation/NSSwiftRuntime.swift, line 269

local.env says

 # Kitura server
 export KITURA_host="barneyrt.mybluemix.net"
 export KITURA_port=80
 export KITURA_schema="http://"

Tags and weather are written to the Cloudant data when the debug sequences are invoked.

For more detail please see this StackOverflow question

triceam commented 8 years ago

I believe the issue is the quotes around both KITURA_host and KITURA_schema. The sequence is just spitting back whatever error message it gets from Swift - in this case I'm pretty sure it's getting a null response from the request to the Kitura server, which is the root cause of the Unable to convert value of type Optional<protocol<>>: file Foundation/NSSwiftRuntime.swift, line 269 error message.

Here's what Mine looks like: # Kitura server export KITURA_host=bluepic-dev.mybluemix.net export KITURA_port=80 export KITURA_schema=http://

When you look at the document in Cloudant, do you see that the weather conditions and tags have been written to the database?

I'm in the process of rewriting the sequence into an orchestrator action that will give us better error messages.

iainhouston commented 8 years ago

@triceam thanks.

This is the situation now:

BTW I think I tried every export combination with and without quotes in local.env. Anyhow have reverted to no-quotes now and re-installed the actions and deployed the Bluepic server app again - results above subsequent to this.

iainhouston commented 8 years ago

@triceam Oh yes it does! In the time it took me to write the comment above and have a cup of tea the "person" tag appeared on the IOS app's info page of the uploaded image. Takes a fair time to get there.

triceam commented 8 years ago

The error "The requested resource does not exist" probably is coming from an issue communicating with the server - meaning it can't find the server. The processCallback action is slightly different since its an intermediary step. Instead of imageId you need to pass in cloudantId: wsk action invoke bluepic/processCallback -p cloudantId <cloudant id> -b

triceam commented 8 years ago

Yeah, the sequence takes a while if its doing a cold-start on the actions. If you have the cloudant id, have verified the data gets persisted, and want to test the callback step faster, then just user processCallback like the comment https://github.com/IBM-Swift/BluePic/issues/283#issuecomment-228384264

triceam commented 8 years ago

IF processCallback is successful, it pushes a notification to the client app immediately. If not, the client app doesn't get updated data until that data is requested from the Kitura server again

iainhouston commented 8 years ago

@triceam thanks. Gradually getting my head around what's going on.