Skip to content

Commit

Permalink
refactor: make handler private field
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Jul 27, 2022
1 parent d8cfe84 commit fbdb162
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/lambda/LambdaFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export default class LambdaFunction {

#functionName = null

#handler = null

#handlerRunner = null

#idleTimeStarted = null
Expand Down Expand Up @@ -86,6 +88,7 @@ export default class LambdaFunction {
// this._executionTimeout = null
this.#functionKey = functionKey
this.#functionName = name
this.#handler = handler
this.#memorySize = memorySize
this.#region = provider.region
this.#runtime = runtime
Expand All @@ -95,7 +98,7 @@ export default class LambdaFunction {

const env = {
...(options.localEnvironmentVariables && process.env),
...this.#getAwsEnvVars(handler),
...this.#getAwsEnvVars(),
...provider.environment,
...functionDefinition.environment,
IS_OFFLINE: 'true',
Expand Down Expand Up @@ -176,9 +179,9 @@ export default class LambdaFunction {

// based on:
// https://github.com/serverless/serverless/blob/v1.50.0/lib/plugins/aws/invokeLocal/index.js#L108
#getAwsEnvVars(handler) {
#getAwsEnvVars() {
return {
_HANDLER: handler,
_HANDLER: this.#handler,
AWS_DEFAULT_REGION: this.#region,
AWS_LAMBDA_FUNCTION_MEMORY_SIZE: this.#memorySize,
AWS_LAMBDA_FUNCTION_NAME: this.#functionName,
Expand Down

0 comments on commit fbdb162

Please sign in to comment.