Skip to content

Commit e85ef03

Browse files
committed
patch mounting of code if the function uses a lamda
1 parent 62b9d5e commit e85ef03

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

example/service/serverless.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ provider:
44
name: aws
55
profile: ${opt:profile, self:custom.profile}
66
stage: ${opt:stage, self:custom.defaultStage}
7-
runtime: nodejs16.x
7+
runtime: nodejs20.x
88
lambdaHashingVersion: '20201221'
99

1010
custom:

spec/helpers/services.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const defaultConfig = {
1616
service: 'aws-nodejs',
1717
provider: {
1818
name: 'aws',
19-
runtime: 'nodejs12.x',
19+
runtime: 'nodejs20.x',
2020
lambdaHashingVersion: '20201221',
2121
environment: {
2222
LAMBDA_STAGE:

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ class LocalstackPlugin {
198198

199199
// Patch plugin methods
200200
function compileFunction(functionName) {
201-
if (!this.shouldMountCode()) {
201+
const functionObject = this.serverless.service.getFunction(functionName);
202+
if (functionObject.image || !this.shouldMountCode()) {
202203
return compileFunction._functionOriginal.apply(null, arguments);
203204
}
204-
const functionObject = this.serverless.service.getFunction(functionName);
205205
functionObject.package = functionObject.package || {};
206206
functionObject.package.artifact = __filename;
207207
return compileFunction._functionOriginal

0 commit comments

Comments
 (0)