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

Error when using external config files #16

Open
mtford90 opened this issue Feb 27, 2019 · 5 comments
Open

Error when using external config files #16

mtford90 opened this issue Feb 27, 2019 · 5 comments
Assignees

Comments

@mtford90
Copy link

I have the following line in my config:

provider:
  name: aws
  # ...
  environment: ${file(../../serverless/consumer_env.yml)}

When I run serverless deploy I see the following:

 Cannot create property 'SERVERLESS_EXPRESS_PLATFORM' on string '${file(../../serverless/consumer_env.yml)}'
@iliasbhal iliasbhal self-assigned this Feb 27, 2019
@iliasbhal
Copy link
Collaborator

Hi, @mtford90,
I'm looking at it right now

@iliasbhal
Copy link
Collaborator

iliasbhal commented Feb 27, 2019

@mtford90

  • I did the exact same configuration, and it didn't throw any error
  • the function is deployed with all environment variables.

I'd like to investigate more,
Can you share the versions of your local serverless-cli and serverless-express ?

@mtford90
Copy link
Author

mtford90 commented Feb 27, 2019

Hey @iliasbhal - appreciate the speed!

  • serverless-express: 2.0.11
  • serverless-cli: 1.38.0
  • Node: 8.10.0

Here's my full yml (with some obfuscation):

service:
  name: xxx

plugins:
  - serverless-webpack
  - serverless-express

custom:
  stages:
    - dev
    - prod
  ssm: ${file(../../serverless/ssm.yml)}
  # https://github.com/serverless-heaven/serverless-webpack/issues/342#issuecomment-383248835
  webpack:
    packExternalModulesMaxBuffer: 1000000
    includeModules: true
    packagerOptions:
      scripts:
        - npm rebuild grpc --target=8.1.0 --target_arch=x64 --target_platform=linux --target_libc=glibc
  iamRoleStatements:
    - Effect: Allow
      Action:
        - s3:HeadBucket
        - s3:GetObject
        - s3:ListBucket
      Resource: "xxx"
    - Effect: Allow
      Action:
        - s3:GetObject
        - s3:GetObjectAcl
        - s3:PutObjectTagging
        - s3:ListBucket
        - s3:PutObjectVersionTagging
        - s3:PutObjectVersionAcl
        - s3:GetObjectTagging
        - s3:PutObject
        - s3:PutObjectAcl
      Resource: "xxx"

provider:
  name: aws
  region: eu-central-1
  runtime: nodejs8.10
  timeout: 32
  stage: ${opt:stage,'dev'}
  environment: ${file(../../serverless/consumer_env.yml)}
  vpc:
    securityGroupIds:
      - xxx
    subnetIds:
      - xxx
      - xxx
      - xxx

functions:
  express:
    handler: src/lambda.handler
    memorySize: 2048
    environment:
      SENTRY_DSN: xxx
    events:
      - http:
          path: /{proxy+}
          method: ANY

package:
  #  individually: true
  exclude:
    - ./node_modules/ava/**
    - ./**/*.test.ts

@iliasbhal
Copy link
Collaborator

iliasbhal commented Mar 1, 2019

@mtford90 I'll try to take time to fix this bug soon
In the meantime, you can do this quick hotfix:

Assign the variables to the function instead of the provider.
I tested it and it's working great. but it's a hotfix, I'll push something soon

functions:
  express:
    handler: src/lambda.handler
    memorySize: 2048
    environment:  ${file(../../serverless/consumer_env.yml)}

@stevensnoeijen
Copy link

what's the status on this? I need this fix too ^_^

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

3 participants