@@ -392,6 +392,7 @@ def raise_exception_handler(json_input, lambda_context):
392
392
expected_response = {
393
393
"errorType" : "FaultExceptionType" ,
394
394
"errorMessage" : "Fault exception msg" ,
395
+ "requestId" : "invoke_id" ,
395
396
"stackTrace" : ["trace_line1\n trace_line2" , "trace_line3\n trace_line4" ],
396
397
}
397
398
bootstrap .handle_event_request (
@@ -988,6 +989,35 @@ def test_log_error_empty_stacktrace_line_framed_log_sink(self):
988
989
actual_message = content [8 :].decode ()
989
990
self .assertEqual (actual_message , expected_logged_error )
990
991
992
+ # Just to ensure we are not logging the requestId from error response, just sending in the response
993
+ def test_log_error_invokeId_line_framed_log_sink (self ):
994
+ with NamedTemporaryFile () as temp_file :
995
+ with bootstrap .FramedTelemetryLogSink (temp_file .name ) as log_sink :
996
+ err_to_log = bootstrap .make_error (
997
+ "Error message" ,
998
+ "ErrorType" ,
999
+ ["line1" , "" , "line2" ],
1000
+ "testrequestId" ,
1001
+ )
1002
+ bootstrap .log_error (err_to_log , log_sink )
1003
+
1004
+ expected_logged_error = (
1005
+ "[ERROR] ErrorType: Error message\n Traceback "
1006
+ "(most recent call last):\n line1\n \n line2"
1007
+ )
1008
+
1009
+ with open (temp_file .name , "rb" ) as f :
1010
+ content = f .read ()
1011
+
1012
+ frame_type = int .from_bytes (content [:4 ], "big" )
1013
+ self .assertEqual (frame_type , 0xA55A0001 )
1014
+
1015
+ length = int .from_bytes (content [4 :8 ], "big" )
1016
+ self .assertEqual (length , len (expected_logged_error ))
1017
+
1018
+ actual_message = content [8 :].decode ()
1019
+ self .assertEqual (actual_message , expected_logged_error )
1020
+
991
1021
992
1022
class TestUnbuffered (unittest .TestCase ):
993
1023
def test_write (self ):
0 commit comments