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
108
108
let event = next_event_response?;
109
109
let ( parts, body) = event. into_parts ( ) ;
110
110
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
+
111
119
let ctx: Context = Context :: try_from ( parts. headers ) ?;
112
120
let ctx: Context = ctx. with_config ( config) ;
113
121
let request_id = & ctx. request_id . clone ( ) ;
@@ -128,6 +136,12 @@ where
128
136
let body = hyper:: body:: to_bytes ( body) . await ?;
129
137
trace ! ( "incoming request payload - {}" , std:: str :: from_utf8( & body) ?) ;
130
138
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
+
131
145
let body = match serde_json:: from_slice ( & body) {
132
146
Ok ( body) => body,
133
147
Err ( err) => {
You can’t perform that action at this time.
0 commit comments