@@ -392,6 +392,7 @@ def raise_exception_handler(json_input, lambda_context):
392392        expected_response  =  {
393393            "errorType" : "FaultExceptionType" ,
394394            "errorMessage" : "Fault exception msg" ,
395+             "requestId" : "invoke_id" ,
395396            "stackTrace" : ["trace_line1\n trace_line2" , "trace_line3\n trace_line4" ],
396397        }
397398        bootstrap .handle_event_request (
@@ -988,6 +989,35 @@ def test_log_error_empty_stacktrace_line_framed_log_sink(self):
988989                actual_message  =  content [8 :].decode ()
989990                self .assertEqual (actual_message , expected_logged_error )
990991
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+ 
9911021
9921022class  TestUnbuffered (unittest .TestCase ):
9931023    def  test_write (self ):
0 commit comments