Extendng Web Service

Working through the Extending Web Services / Web services tutorials, Siren platform 11.1.3, invoking the “beginner” string reverse service and I get an internal server error:

“message”:“The service example-web-service-group-stringreverser returned an array, but should only be returning either single object (if storing results in the invocation index) or an object of the structure { indexSuffix: [result1, result2] } result in the invocation index, but it returned an array of objects; it must return only one result.”

Any/all help is greatly appreciated! The idea of consuming REST service results is VERY POWERFUL! :slight_smile:

Hi Richard,

The output of the invoke function should not be an array, but just an object.

Please use this

return {
  reversed_message: reversed_input

instead of

return [{
  reversed_message: reversed_input

This should resolve the issue.

We will correct this in our documentation of webservice.


1 Like

Thank you! I actually made that change. But I didn’t restart Investigate. Rookie mistake. :frowning: Now it works. Thank you again!!!

1 Like

Okay, since we are modifying the Beginner Tutorial documentation, you also need to fix the Intermediate Tutorial documentation!!! :slight_smile:

You need to change, in index.js:

import { MyWeatherService } from ‘./MyWeatherService’;


import { MyWeatherService } from ‘./src/MyWeatherService’;


1 Like

Finally, there is an issue with the Advanced Tutorial. :frowning: I followed the tutorial and registered my OpenWeatherMap.org app ID in config/investigate.yml, but I get an invalid app id message when running in Siren (node invoke works fine). If I change the code to hard-code the app ID the service works in Siren. So there appears to be a problem extracting the app ID via this.config.auth_token in MyGeneratedService.ts.

Any help would be greatly appreciated!