Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Not compatible with serverless-dotenv-plugin #1

Open
ronaldborla opened this issue Jan 22, 2020 · 5 comments
Open

Not compatible with serverless-dotenv-plugin #1

ronaldborla opened this issue Jan 22, 2020 · 5 comments

Comments

@ronaldborla
Copy link

For some reason, the imported file is not compatible with this plugin: https://github.com/colynb/serverless-dotenv-plugin

It does not use environment variables.

The plugin looks promising, I would like to contribute but I'm a bit occupied at the moment. I hope you can check this out. Thanks!

@KrysKruk
Copy link
Owner

Hi @ronaldborla.

I use serverless-dotenv-plugin together with this plugin in my projects and it works fine for me.
I wanted to be sure so I checked it on a fresh config and still, no issues.

Do you see any errors or can you provide more informations what exactly doesn't work for you?
Do you see Serverless: DOTENV: Loading environment variables from .env: log when packaging your serverless project?

So I created a imported.yml file with a content:

functions:
  func1:
    handler: ${env:TEST_FUNC1}.handler
  func2:
    handler: ${env:TEST_FUNC2}.handler

In the main serverles.yml file I placed:

service: test1
plugins:
  - serverless-import-config-plugin
  - serverless-dotenv-plugin
custom:
  import:
    - ./imported.yml
provider:
  name: aws
package:
  individually: true

... and I had no issues with using env variables from the .env file.

Please let me know how I can help here. Thanks.

@ignacioalles
Copy link

I've also had some problems replacing variables in imported files (like ${env:xxx}, ${self:xxx}). Reverting to a previous version of serverless framework made it work again.
Serverless: 2.10.0 works while latest 2.28 does not.

@sidouglas
Copy link

I hit this issue today too. Reverting to 2.10.0 solved it for me. Thank you @ignacioalles

@LaszloDev
Copy link

Can confirm also that when upgrading serverless to the latest version, the creation of the Cloud Formation configuration file does break. In specific all the serverless pseudo variables are not replaced by values, in stead its names end up in the outout file. This breaks the deployment.

Would be great if you can take a look @KrysKruk

@KrysKruk
Copy link
Owner

@LaszloDev I came up to the same bug after updating serverless some time ago. Unfortunately I'm not currently using the serverless project (I was struggling with migrating from AWS to Azure and it was just easier to write Azure Functions configs manually than using serverless which favors AWS).
Because of that and my limited time recently I'm open to PRs. I can also make someone a maintainer on npm.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants