File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,14 @@ where
108108 let event = next_event_response?;
109109 let ( parts, body) = event. into_parts ( ) ;
110110
111+ #[ cfg( debug_assertions) ]
112+ if parts. status == http:: StatusCode :: NO_CONTENT {
113+ // Ignore the event if the status code is 204.
114+ // This is a way to keep the runtime alive when
115+ // there are no events pending to be processed.
116+ continue ;
117+ }
118+
111119 let ctx: Context = Context :: try_from ( parts. headers ) ?;
112120 let ctx: Context = ctx. with_config ( config) ;
113121 let request_id = & ctx. request_id . clone ( ) ;
@@ -128,6 +136,12 @@ where
128136 let body = hyper:: body:: to_bytes ( body) . await ?;
129137 trace ! ( "incoming request payload - {}" , std:: str :: from_utf8( & body) ?) ;
130138
139+ #[ cfg( debug_assertions) ]
140+ if parts. status . is_server_error ( ) {
141+ error ! ( "Lambda Runtime server returned an unexpected error" ) ;
142+ return Err ( parts. status . to_string ( ) . into ( ) ) ;
143+ }
144+
131145 let body = match serde_json:: from_slice ( & body) {
132146 Ok ( body) => body,
133147 Err ( err) => {
You can’t perform that action at this time.
0 commit comments