@@ -50,7 +50,7 @@ class RustPlugin {
50
50
this . serverless . service . package . excludeDevDependencies = false ;
51
51
}
52
52
53
- runDocker ( funcArgs , cargoPackage , binary ) {
53
+ runDocker ( funcArgs , cargoPackage , binary , profile ) {
54
54
const cargoHome = process . env . CARGO_HOME || path . join ( homedir ( ) , ".cargo" ) ;
55
55
const cargoRegistry = path . join ( cargoHome , "registry" ) ;
56
56
const cargoDownloads = path . join ( cargoHome , "git" ) ;
@@ -70,7 +70,6 @@ class RustPlugin {
70
70
const customArgs = [ ] ;
71
71
72
72
let cargoFlags = ( funcArgs || { } ) . cargoFlags || this . custom . cargoFlags ;
73
- let profile = ( funcArgs || { } ) . profile || this . custom . profile ;
74
73
if ( profile ) {
75
74
// release or dev
76
75
customArgs . push ( "-e" , `PROFILE=${ profile } ` ) ;
@@ -121,7 +120,8 @@ class RustPlugin {
121
120
binary = cargoPackage ;
122
121
}
123
122
this . serverless . cli . log ( `Building native Rust ${ func . handler } func...` ) ;
124
- const res = this . runDocker ( func . rust , cargoPackage , binary ) ;
123
+ let profile = ( func . rust || { } ) . profile || this . custom . profile ;
124
+ const res = this . runDocker ( func . rust , cargoPackage , binary , profile ) ;
125
125
if ( res . error || res . status > 0 ) {
126
126
this . serverless . cli . log (
127
127
`Dockerized Rust build encountered an error: ${ res . error } ${ res . status } .`
@@ -137,7 +137,7 @@ class RustPlugin {
137
137
// we leverage the ability to declare a package artifact directly
138
138
// see https://serverless.com/framework/docs/providers/aws/guide/packaging/
139
139
// for more information
140
- const artifactPath = path . join ( " target/lambda/release" , binary + ".zip" ) ;
140
+ const artifactPath = path . join ( ` target/lambda/${ 'dev' === profile ? 'debug' : ' release' } ` , binary + ".zip" ) ;
141
141
func . package = func . package || { } ;
142
142
func . package . artifact = artifactPath ;
143
143
0 commit comments