Skip to content

Comments

Change: Ensure dotenv.load called before AWS load#369

Merged
DeviaVir merged 1 commit intomotdotla:masterfrom
nonword:pb/move-dotenv-load
Aug 14, 2017
Merged

Change: Ensure dotenv.load called before AWS load#369
DeviaVir merged 1 commit intomotdotla:masterfrom
nonword:pb/move-dotenv-load

Conversation

@nonword
Copy link
Contributor

@nonword nonword commented Aug 14, 2017

This PR simply changes the the place dotenv.load is called to a few lines earlier, before requiring aws-sdk. This means the contents of one's .env is loaded into process.env before anything in AWS-SDK executes. This resolves an issue we've seen where aws-sdk seems to use globally set AWS creds instead of those in ./.env. This seems to be a source of frustration for others. The issue becomes apparent when one attempts to use node-lambda as a dev dependency (rather than, as instructed, globally installed) in an app with other aws-sdk dependencies.

This new placement of dotenv.load does not seem to have any effect on tests. Also dotenv does not seem to rely on side-effects of any code executed before it. So I don't see any reason dotenv.load should not be called in this new position (apart from this being an odd place to fix an aws-sdk quirk).

Copy link
Collaborator

@DeviaVir DeviaVir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough, no reason not to support this 👍

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

Successfully merging this pull request may close these issues.

2 participants