Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment variables are not handled properly #6

Open
mathieudevos opened this issue Dec 5, 2017 · 0 comments
Open

Environment variables are not handled properly #6

mathieudevos opened this issue Dec 5, 2017 · 0 comments

Comments

@mathieudevos
Copy link

mathieudevos commented Dec 5, 2017

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)

@mathieudevos mathieudevos changed the title Environment does not take dictionary as input Environment does variables are not handled properly Dec 5, 2017
@mathieudevos mathieudevos changed the title Environment does variables are not handled properly Environment variables are not handled properly Dec 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant