Fix error thrown when logging http function invocation
This commit is contained in:
3
app.py
3
app.py
@@ -210,8 +210,7 @@ def execute_http_function(function):
|
|||||||
response = requests.post(API_URL, json={'code': code, 'request': request_data, 'environment': environment})
|
response = requests.post(API_URL, json={'code': code, 'request': request_data, 'environment': environment})
|
||||||
response_data = response.json()
|
response_data = response.json()
|
||||||
|
|
||||||
db.update_http_function_environment_info_and_invoked_count(function, json.dumps(response_data['environment']))
|
db.update_http_function_environment_info_and_invoked_count(function, response_data['environment'])
|
||||||
|
|
||||||
db.add_http_function_invocation(http_function['id'], response_data['status'], request_data, response_data['result'], response_data['logs'])
|
db.add_http_function_invocation(http_function['id'], response_data['status'], request_data, response_data['result'], response_data['logs'])
|
||||||
|
|
||||||
# Map the Node.js response to Flask response
|
# Map the Node.js response to Flask response
|
||||||
|
|||||||
4
db.py
4
db.py
@@ -67,7 +67,7 @@ class DataBase():
|
|||||||
|
|
||||||
def update_http_function_environment_info_and_invoked_count(self, name, environment_info):
|
def update_http_function_environment_info_and_invoked_count(self, name, environment_info):
|
||||||
self.execute(
|
self.execute(
|
||||||
'UPDATE http_functions SET environment_info=%s, invoked_count = invoked_count + 1 WHERE NAME=%s', [environment_info, name], commit=True)
|
'UPDATE http_functions SET environment_info=%s, invoked_count = invoked_count + 1 WHERE NAME=%s', [json.dumps(environment_info), name], commit=True)
|
||||||
|
|
||||||
def delete_http_function(self, name):
|
def delete_http_function(self, name):
|
||||||
self.execute(
|
self.execute(
|
||||||
@@ -75,4 +75,4 @@ class DataBase():
|
|||||||
|
|
||||||
def add_http_function_invocation(self, http_function_id, status, request_data, response_data, logs):
|
def add_http_function_invocation(self, http_function_id, status, request_data, response_data, logs):
|
||||||
self.execute(
|
self.execute(
|
||||||
'INSERT INTO http_function_invocations (http_function_id, status, request_data, response_data, logs) VALUES (%s, %s, %s, %s)', [http_function_id, status, json.dumps(request_data), json.dumps(response_data), json.dumps(logs)], commit=True)
|
'INSERT INTO http_function_invocations (http_function_id, status, request_data, response_data, logs) VALUES (%s, %s, %s, %s, %s)', [http_function_id, status, json.dumps(request_data), json.dumps(response_data), json.dumps(logs)], commit=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user