Skip to content

Commit ec788f3

Browse files
committed
wsk: return 200 whenever we have a response from the app
We were returning the same status code as we got from DEEPaaS. This makes OpenWhisk fail, since OpenWisk takes this status and returns an unexpected failure. Now we always return 200 if we got a response from the API (regardless of a success or not), 500 otherwise
1 parent 5b637cc commit ec788f3

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

deepaas/openwhisk/handle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ async def invoke(app, request, args):
125125
else:
126126
body = base64.b64encode(response.text)
127127

128-
return response.status, {
128+
return {
129129
'headers': dict(response.headers),
130130
'statusCode': response.status,
131131
'body': body

deepaas/openwhisk/proxy.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,12 @@ async def run(request):
8686
return error_bad_request()
8787

8888
try:
89-
status, result = await handle.invoke(APP, req_clone, args)
90-
response = web.json_response(result, status=status)
89+
result = await handle.invoke(APP, req_clone, args)
90+
# NOTE(aloga): we got a response, even if it is a failure, therefore we
91+
# return a 200 error
92+
response = web.json_response(result, status=200)
9193
except Exception as e:
92-
raise e
94+
# NOTE(aloga): something weird happened server-side, return a 500.
9395
response = web.json_response(
9496
{'error': 'Internal error. {}'.format(e)},
9597
status=500

0 commit comments

Comments
 (0)