Overwriting environment variables when invoking local function

Hey,

I am setting environment variables in serverless.yml like this:

  environment:
    DYNAMODB_TABLE:
      Ref: DynamodDBTable

That does not work with local function invocation, because than the variable is set to: [object Object].

Can I somehow overwrite the environment variables when invoking lambda local?

1 Like

Local references don’t work like that because they require a lookup to the CloudFormation stack. I wrote a post about this that should help you accomplish what you want: