Skip to content
This repository was archived by the owner on Nov 6, 2021. It is now read-only.
This repository was archived by the owner on Nov 6, 2021. It is now read-only.

bug: environment messed up #31

@franciscocpg

Description

@franciscocpg

Giving the following serverless configuration

function1:
  handler: file1.handler
  environmentSecrets:
      ENV1: '/my-project/${opt:stage}/ENV1'

function2:
  handler: file2.handler
  environmentSecrets:
      ENV2: '/my-project/${opt:stage}/ENV2'

When invoking function1 the environment is injected with ENV2 variable instead of ENV1. And that's because of the the code below:

const environments = Object.keys(functions)
.reduce((environments, key) => {
const functionName = functions[key].handler.split('.')[1]
if (functions[key].environmentSecrets) {
environments[functionName] = functions[key].environmentSecrets
}
return environments
}, {})

I've done a fix for me (franciscocpg@1914052) and it worked the way I've expected but before proposing a PR I'd like to know the rationale behind this split.

Maybe there is something I'm not seeing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions