StackStorm / st2web

StackStorm Web UI
http://www.stackstorm.com/features
Apache License 2.0
103 stars 82 forks source link

UI changes for Enhancement of Error Message #906

Closed pradnya-orchestral closed 3 years ago

pradnya-orchestral commented 3 years ago

When output value fails schema validation defined in the output schema, the st2web UI does not display the validation error but returns // Action produced no data. The issue here is that the backend writes the error message in the "error" key in the result and the UI is hard coded for local/remote/python runners which expects the error to be under the "stderr" key in the result.

Example output schema in the meta data YAML file:

output_schema:
    osTestParam:
        description: test parameter
        type: string
        required: true
        secret: true

In python script:

class SampleAction(Action):
    def run(self):
        osTestParam = None
        return {"osParam": osTestParam}

If this action ran from st2 web UI then it gives // Action produced no data output in action output box.

The patch here fixes the st2web UI to look for the error key as well. Modifying the backend to write the error to stderr seems inappropriate to avoid polluting the stderr field and since the validation can come from other runner types that doesn't have stderr.