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

NODE_ENV is always "production" when running "netlify-lambda serve..." #163

Closed
rub1e opened this issue Jun 23, 2019 · 4 comments
Closed
Labels

Comments

@rub1e
Copy link

rub1e commented Jun 23, 2019

I've followed the excellent @sw-yx static/dynamic tutorial and I'm trying to build on it to include local env vars in development

I've set up a .env.development file and I'm trying to use NODE_ENV to set the correct .env filepath in development.

But when I run the start scripts (gatsby develop and netlify-lambda serve src/lambda), I get two different NODE_ENVs 😕

  • In gatsby-config.js it logs "development"
  • In src/lambda/hello.js it logs "production" 🤕

Apologies if this is obvious / expected behaviour, but I've run out of ideas 😖

@swyxio
Copy link
Contributor

swyxio commented Jun 23, 2019

hmm. what version are you on? we addressed this here #119 may just need an update

@rub1e
Copy link
Author

rub1e commented Jun 24, 2019

I'm on 1.4.13

I did see #123 from #119 but that fix is for build, whereas the issue I'm having is with serve

I've tried going through https://github.com/netlify/netlify-lambda/blob/master/lib/serve.js but I can't figure out why this would be. Happy to do a PR if you can point me in the right direction!

@swyxio
Copy link
Contributor

swyxio commented Jun 24, 2019

i'm not sure either. dont have time to go through this in detail right now. if you have the time, this one should be a matter of placing a few strategic console.log's inside your netlify-lambda instance to figure out where your NODE_ENV is getting introduced.

@stale
Copy link

stale bot commented Aug 23, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 23, 2019
@stale stale bot closed this as completed Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants