apache / openwhisk

Apache OpenWhisk is an open source serverless cloud platform
https://openwhisk.apache.org/
Apache License 2.0
6.5k stars 1.16k forks source link

Get summary of an action throws "string indices must be integers" exception #848

Closed tareqmamari closed 7 years ago

tareqmamari commented 8 years ago

Environment details:

whisk CLI version   2016-04-08T03:37:43-05:00
whisk API build     2016-06-27T18:51:10Z
whisk API buildno   jenkins-mainWhisk-18130

Steps to reproduce the issue:

Whenever I get summary of a specific action, a strange exception throws: wsk action get --summary iot/register_device

the other actions can be gotten well !

Expected results and outputs:

I expect a summary of the action.

Actual results and outputs:

Exception: string indices must be integers

Additional Information

invocation of the action is working well !

Install script:

$WSK_CLI --apihost "$APIHOST" action update --auth "$AUTH" --shared yes iot/register_device "$PACKAGE_HOME/actions/register_device.js" \
    -a description 'Register new device to Watson IoT platform' \
    -a parameters '[{"name":"apiKey","required":true,"bindTime":true,"description":"Watson IoT platform API Key"},{"name":"apiToken","required":true,"bindTime":true,"description":"Authentication token of an Watson IoT platform","type":"password"},{"name":"orgId","required":true,"bindTime":true,"description":"IoT platform Organization Id"},{"name":"deviceId","required":true,"bindTime":true, "description": "Device ID"},{"name":"typeId","required":true,"bindTime":true,"description":"Device Type ID"},{"name":"deviceAuthToken","required":false,"bindTime":false"type":"password"},{"name":"serialNumber","required":false,"bindTime":false,"description":"Serial number of the device"},{"name":"manufacturer","required":false,"bindTime":false,"description":"Manufacturer of the device"},{"name":"model","required":false,"bindTime":false,"description":"Model of the device"},{"name":"deviceClass","required":false,"bindTime":false,"description":"Class of the device"},{"name":"description","required":false,"bindTime":false,"description":"Descriptive name of the device"},{"name":"fwVersion","required":false,"bindTime":false,"description":"Firmware version currently known to be on the device"},{"name":"hwVersion","required":false,"bindTime":false,"description":"Hardware version of the device"},{"name":"descriptiveLocation","required":false,"bindTime":false,"description":"Descriptive location, such as a room or building number, or a geographical region"},{"name":"long","required":false,"bindTime":false,"description":"Longitude in decimal degrees using the WGS84 system"},{"name":"lat","required":false,"bindTime":false,"description":"Latitude in decimal degrees using the WGS84 system"},{"name":"elev","required":false,"bindTime":false,"description":"Elevation in meters using the WGS84 system"},{"name":"accuracy","required":false,"bindTime":false,"description":"Accuracy of the position in meters"},{"name":"measuredDateTime","required":false,"bindTime":false,"description":"Date and time of location measurement (ISO8601)"},{"name":"metadata","required":false,"bindTime":false,"description":"Metadata of the device"}]' \
    -a sampleInput '{ "apiKey": "XXXXXX", "apiToken": "YYYYYY", "orgId": "ZZZZ", "typeId": "Raspberry_Pi" ,"deviceId":"deviceId" }' \
    -a sampleOutput '{"apiToken":"xxxxxxxxx","clientId":"d:orgId:Raspberry_Pi:deviceId","deviceId":"deviceId","deviceInfo":{},"refs":{"diag":{"errorCodes":"/api/v0002/device/types/Raspberry_Pi/devices/deviceId/diag/errorCodes/","logs":"/api/v0002/device/types/Raspberry_Pi/devices/deviceId/diag/logs/"},"location":"/api/v0002/device/types/Raspberry_Pi/devices/deviceId/location/"},"registration":{"auth":{"id":"apiKey","type":"app"},"date":"2016-06-16T10:46:08.000Z"},"status":{"alert":{"enabled":false,"timestamp":"2016-06-16T10:46:08.965Z"}},"typeId":"Raspberry_Pi"}'
dubee commented 7 years ago

@tareqmamari, you are missing a comma in the annotations for parameters. See"bindTime":false"type":"password"}. The CLI will no longer allow for invalid JSON to be used for parameters and annotations. As a result, the command provided will not work until the comma is added. After fixing the annotation, retrieving the action works properly.

@csantanapr, please close this issue.