Skip to content

Variables from external yml file not being referenced properly when writing to lambda environment #5272

@AJF4

Description

@AJF4

This is a Bug Report

Description

  • What went wrong?

I'm using a config.yml which is imported wholly as self:custom.parameters.
Some of the variables within the config.yml are passed to a lambda as environment variables.
The stack deploys properly, but inspecting the values written to the lambda environment shows that they are incorrect. They have values similar to : ${{deep:5}.concat_regex}

  • What did you expect should have happened?

The values written to the environment should be the dereferenced version, ie the value of concat_regex

  • What was the config you used?

serverless.yml (abridged)

service: test_service

custom:
  parameters: ${file(${{opt:config_file}})}
  topicName: 'TestTopic'

provider:
  variableSyntax: "\\${{([ ~:a-zA-Z0-9._\\'\",\\-\\/\\(\\)]+?)}}"
  name: aws
  runtime: python3.6
  timeout: 300

functions:
  startup:
    handler: handler.startup
    events:
      - sns:
          arn:
            Ref: UploadNotificationTopic
          topicName:  ${{self:custom.newItemNotificationTopic}}
    environment:
      concat_regex: ${{self:custom.parameters.concat_regex}}

config.yml

concat_regex: '.*list\.lst$'
  • What stacktrace or error message from your provider did you see?

No errors reported, but Startup lambda environment actually has value ${{deep:5}.concat_regex} instead of *list.lst$

Similar or dependent issues:
*

Additional Data

  • Serverless Framework Version you're using:
    Originally found on 1.27.3, now upgrade to 1.30.3
  • Operating System:
    Mac OS 10.13.6
  • Stack Trace:
  • Provider Error messages:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions