thoreinstein / serverless-offline-ssm

Read SSM parameters from a .env file instead of AWS
MIT License
94 stars 24 forks source link

Failing to find .env with serverless v1.70.1 #31

Open alexb-uk opened 4 years ago

alexb-uk commented 4 years ago

Hi,

I've tried updating to the latest versions of serverless and serverless-offline-ssm but it appears that serverless 1.70.1 is causing .env to no longer be picked up.

Works:

"serverless": "^1.67.3",
"serverless-offline": "^6.1.5",
"serverless-offline-sns": "^0.68.0",
"serverless-offline-ssm": "^4.1.2",
"serverless-plugin-tracing": "^2.0.0",
"serverless-webpack": "^5.3.2",

Does not pick up .env:

 Serverless Warning --------------------------------------

  A valid SSM parameter to satisfy the declaration 'ssm:/xxx/yyy/zzz' could not be found.
"serverless": "^1.70.1",
"serverless-offline": "^6.1.5",
"serverless-offline-sns": "^0.68.0",
"serverless-offline-ssm": "^4.1.2",
"serverless-plugin-tracing": "^2.0.0",
"serverless-webpack": "^5.3.2",

Cut down serverless.yml:

provider:
  environment:
    DB_READ_HOST: ${ssm:/${self:provider.stage}/database/read_host}

custom:
  serverless-offline-ssm:
    stages:
        - dev
"serverless": "^1.70.1",
"serverless-offline": "^6.1.5",
"serverless-offline-sns": "^0.68.0",
"serverless-offline-ssm": "^4.1.2",
"serverless-plugin-tracing": "^2.0.0",
"serverless-webpack": "^5.3.2",

Thanks for all you efforts on this library if there's anything I can look into further or provide you with more info please don't hesistate to ask.

Alex

barendb commented 4 years ago

had a quick look ran into the same issue, some of SSM vars was empty "" strings, it then opts to check the .env file for a value.

Once I gave them values it worked fine.

If I have time this weekend I'll PR up a fix.

thoreinstein commented 4 years ago

Sorry I've been MIA, we're still under stay at home orders here in the states and I've trying to balance teaching my kids with still working full time. Doesn't leave much time for open source work :/

@barendb Thank you so much for looking in to this and for all of your contributions to this project. If you wouldn't mind, please shoot me an email as I'd love to chat with you about a few things.

thoreinstein commented 4 years ago

Sorry for the delays in getting around to this. @alexb-uk, I'm wondering if 122704e3cf76246d3b9eee71f33ca2dda0d1679b may not have fixed your issue. Can you please try updating to the latest 5.X version and try again.

milanzivic commented 4 years ago

I have a similar issue:

  1. When I'm using serverless@1.67.0 and serverless-offline-ssm@4.1.2 everything works fine
  2. When I bump to serverless@1.77.1 and still use serverless-offline-ssm@4.1.2 - I'm getting the issue described above
  3. When I bump to serverless-offline-ssm@5.0.2, no matter what version of serverless I'm using, I get this: Error: serverless-offline-ssm missing configuration stages.
thoreinstein commented 4 years ago

@milanzivic Sorry, I've been out on vacation. Can you please provide an example repository pinning the specific versions of serverless and all of the plugins that you are using?

milanzivic commented 4 years ago

@janders223 don't worry man, it's all good.

I can do it over the weekend and send it your way by Monday if that's good with you.