Skip to content

Undefined variables being casted to the "undefined" string #3491

Description

@lukejagodzinski

This is a Bug Report

Description

  • What went wrong?

In the serverless.yml file I have defined some environment variables:

provider:
  name: aws
  runtime: nodejs6.10
  profile: jagi
  environment:
    STAGE: ${opt:stage}

In some cases ${opt:stage} may be undefined, for example on localhost when using serverless-offline. When it's undefined it gets converted to the "undefined" string.

  • What did you expect should have happened?

I would expect it to be just undefined. It's kinda weird to make comparisons like:

if (process.env.STAGE === 'undefined')

instead

if (process.env.STAGE === undefined)

Additional Data

  • Serverless Framework Version you're using: 1.10.2
  • Operating System: MacOS 10.12.4

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