@@ -26,7 +26,7 @@ use aws_sdk_lambda::operation::get_function::GetFunctionOutput;
2626use aws_sdk_lambda:: primitives:: Blob ;
2727use aws_sdk_lambda:: types:: { Architecture , Environment , FunctionCode , Runtime } ;
2828use quickwit_config:: LambdaDeployConfig ;
29- use tracing:: { debug, info, warn} ;
29+ use tracing:: { debug, error , info, warn} ;
3030
3131use crate :: error:: { LambdaClientError , LambdaClientResult } ;
3232
@@ -50,10 +50,10 @@ pub struct LambdaDeployer {
5050
5151impl LambdaDeployer {
5252 /// Create a new Lambda deployer using default AWS configuration.
53- pub async fn new ( ) -> LambdaClientResult < Self > {
53+ pub async fn new ( ) -> Self {
5454 let aws_config = aws_config:: load_defaults ( aws_config:: BehaviorVersion :: latest ( ) ) . await ;
5555 let client = LambdaClient :: new ( & aws_config) ;
56- Ok ( Self { client } )
56+ Self { client }
5757 }
5858
5959 /// Deploy or update the Lambda function.
@@ -69,10 +69,12 @@ impl LambdaDeployer {
6969
7070 match self . get_function ( function_name) . await {
7171 Ok ( existing) => {
72+ info ! ( "update function if needed" ) ;
7273 self . update_function_if_needed ( function_name, & existing, deploy_config)
7374 . await
7475 }
7576 Err ( LambdaClientError :: NotFound ( _) ) => {
77+ error ! ( "function not found" ) ;
7678 // Function doesn't exist, try to create it
7779 match self
7880 . create_function ( function_name, role_arn, deploy_config)
@@ -89,10 +91,16 @@ impl LambdaDeployer {
8991 self . update_function_if_needed ( function_name, & existing, deploy_config)
9092 . await
9193 }
92- Err ( e) => Err ( e) ,
94+ Err ( e) => {
95+ tracing:: error!( e=?e, "lambda client error on creation" ) ;
96+ Err ( e)
97+ }
9398 }
9499 }
95- Err ( e) => Err ( e) ,
100+ Err ( e) => {
101+ tracing:: error!( e=?e, "lambda client error on get" ) ;
102+ Err ( e)
103+ }
96104 }
97105 }
98106
@@ -367,7 +375,7 @@ pub async fn deploy(
367375 function_name : & str ,
368376 deploy_config : & LambdaDeployConfig ,
369377) -> LambdaClientResult < String > {
370- let lambda_deployer = LambdaDeployer :: new ( ) . await ? ;
378+ let lambda_deployer = LambdaDeployer :: new ( ) . await ;
371379 let lambda_arn = lambda_deployer. deploy ( function_name, deploy_config) . await ?;
372380 info ! ( "successfully deployed lambda function `{}`" , lambda_arn) ;
373381 Ok ( lambda_arn)
0 commit comments