Skip to content

Commit

Permalink
patch mounting of code if the function uses a lamda
Browse files Browse the repository at this point in the history
  • Loading branch information
pinzon committed Oct 31, 2024
1 parent 62b9d5e commit e85ef03
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example/service/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ provider:
name: aws
profile: ${opt:profile, self:custom.profile}
stage: ${opt:stage, self:custom.defaultStage}
runtime: nodejs16.x
runtime: nodejs20.x
lambdaHashingVersion: '20201221'

custom:
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const defaultConfig = {
service: 'aws-nodejs',
provider: {
name: 'aws',
runtime: 'nodejs12.x',
runtime: 'nodejs20.x',
lambdaHashingVersion: '20201221',
environment: {
LAMBDA_STAGE:
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,10 @@ class LocalstackPlugin {

// Patch plugin methods
function compileFunction(functionName) {
if (!this.shouldMountCode()) {
const functionObject = this.serverless.service.getFunction(functionName);
if (functionObject.image || !this.shouldMountCode()) {
return compileFunction._functionOriginal.apply(null, arguments);
}
const functionObject = this.serverless.service.getFunction(functionName);
functionObject.package = functionObject.package || {};
functionObject.package.artifact = __filename;
return compileFunction._functionOriginal
Expand Down

0 comments on commit e85ef03

Please sign in to comment.