Skip to content

Environment variables are not handled properly #6

@mathieudevos

Description

@mathieudevos

Currently the provider.environment setting only takes in [environment] which is defined on line 259 as (text, text).

This is impossible to satisfy with yaml.

It should take in just a dictionary. The issue starts on line 307 [Environment] which already requires a list. And finally the issue completes on line 259 with (Text, Text) which cannot be satisfied by yaml.

Example of perfectly valid test file that breaks this:

service: MyService

frameworkVersion: ">=1.0.0 <2.0.0"

provider:
  name: foobar
  runtime: nodejs4.3
  environment:
    - SOME_VARIABLE: foo

functions:
# HTTP Events
  foo1:
    handler: handler.foo1
    events:
      - http: GET foo
      - http: POST foo

other setup which breaks it (even though serverless would accept this just fine)

service: MyService

frameworkVersion: ">=1.0.0 <2.0.0"

provider:
  name: foobar
  runtime: nodejs4.3
  environment:
    SOME_VARIABLE: foo

functions:
# HTTP Events
  foo1:
    handler: handler.foo1
    events:
      - http: GET foo
      - http: POST foo

Note the difference between environment being a list or an object here, serverless will unpack these as environment variables anyway. The code should reflect this.

Hack to work around this: replace line 259 with Object (but still requires a list input, even though an object is perfectly fine as well)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions