This repository was archived by the owner on Oct 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,19 @@ class ServerlessPythonRequirements {
151151 . then ( cleanup )
152152 . then ( removeVendorHelper ) ;
153153
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+
154167 const before = ( ) => {
155168 if ( ! isFunctionRuntimePython ( arguments ) ) {
156169 return ;
@@ -160,7 +173,8 @@ class ServerlessPythonRequirements {
160173 . then ( pyprojectTomlToRequirements )
161174 . then ( addVendorHelper )
162175 . then ( installAllRequirements )
163- . then ( packRequirements ) ;
176+ . then ( packRequirements )
177+ . then ( setupArtifactPathCapturing ) ;
164178 } ;
165179
166180 const after = ( ) => {
You can’t perform that action at this time.
0 commit comments