You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for this plugin, it fills a big gap in Netlify's tooling.
It is very possible that I've missed something important, so I apologise if I'm reporting an issue that can be addressed by configuration!
Can you let me know if it sounds like I've misconfigured the plugin based on what I say below? If it seems like something that should be fixed, I'm happy to work on a patch/PR .
The basic problem we've seen is that the plugin doesn't rewrites the function in place. This causes three problems, one trivial, and two serious
it rewrites the functions with different babel settings than the project's own settings (this is the trivial one 😃),
it removes the process.env.VARIABLE from the original file, so the function is not transformed on subsequent builds (this is more serious),
it writes the actual values into the functions (this is the most serious one),
Obviously (2) and (3) are what the plugin is for, but writing potentially sensitive env var values into the originals causes problems:
it becomes easy to accidentally commit a sensitive environment variable value (like an API key, etc) to the repository,
it becomes easy to commit a prod or development variable to the repository, introducing bugs (like using a development API key on production or vice-versa).
I'm not deeply familiar with Netlify's build process, but it seems like it might work to do something like this:
retain the plugin's existing defaults so it's default behaviour doesn't change,
provide an input directory parameter for the plugin to read functions from,
continue to use the functions directory specified in netlify.toml to write functions to,
This way, it would be possible to create functions in a directory like e.g. functions, and output them (on Netlify build events) to a git-ignored directory like e.g. functions_replaced. This git-ignored directory would be the functions directory in netlify.toml.
The text was updated successfully, but these errors were encountered:
I'm having this issue as well - when running netlify build on my local machine, this plugin will update/rewrite my local function source code, instead of inlining the variables into the built (.zipped) function code. I wonder if this can be fixed?
Thanks for this plugin, it fills a big gap in Netlify's tooling.
It is very possible that I've missed something important, so I apologise if I'm reporting an issue that can be addressed by configuration!
Can you let me know if it sounds like I've misconfigured the plugin based on what I say below? If it seems like something that should be fixed, I'm happy to work on a patch/PR .
The basic problem we've seen is that the plugin doesn't rewrites the function in place. This causes three problems, one trivial, and two serious
process.env.VARIABLE
from the original file, so the function is not transformed on subsequent builds (this is more serious),Obviously (2) and (3) are what the plugin is for, but writing potentially sensitive env var values into the originals causes problems:
I'm not deeply familiar with Netlify's build process, but it seems like it might work to do something like this:
input
directory parameter for the plugin to read functions from,netlify.toml
to write functions to,This way, it would be possible to create functions in a directory like e.g.
functions
, and output them (on Netlify build events) to a git-ignored directory like e.g.functions_replaced
. This git-ignored directory would be the functions directory innetlify.toml
.The text was updated successfully, but these errors were encountered: