File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,19 @@ class ServerlessPythonRequirements {
151
151
. then ( cleanup )
152
152
. then ( removeVendorHelper ) ;
153
153
154
+ const setupArtifactPathCapturing = ( ) => {
155
+ // Reference:
156
+ // https://github.com/serverless/serverless/blob/9591d5a232c641155613d23b0f88ca05ea51b436/lib/plugins/package/lib/packageService.js#L139
157
+ // The packageService#packageFunction does set artifact path back to the function config.
158
+ // As long as the function config's "package" attribute wasn't undefined, we can still use it
159
+ // later to access the artifact path.
160
+ for ( const functionName in this . serverless . service . functions ) {
161
+ if ( ! serverless . service . functions [ functionName ] . package ) {
162
+ serverless . service . functions [ functionName ] . package = { } ;
163
+ }
164
+ }
165
+ } ;
166
+
154
167
const before = ( ) => {
155
168
if ( ! isFunctionRuntimePython ( arguments ) ) {
156
169
return ;
@@ -160,7 +173,8 @@ class ServerlessPythonRequirements {
160
173
. then ( pyprojectTomlToRequirements )
161
174
. then ( addVendorHelper )
162
175
. then ( installAllRequirements )
163
- . then ( packRequirements ) ;
176
+ . then ( packRequirements )
177
+ . then ( setupArtifactPathCapturing ) ;
164
178
} ;
165
179
166
180
const after = ( ) => {
You can’t perform that action at this time.
0 commit comments