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
Improve error handling when the functions directory does not exist #19
Comments
closed with b42791a |
Hi @bencao, Thanks! 🎉 One note though: https://github.com/bencao/netlify-plugin-inline-functions-env/blob/master/index.js#L35-L41 https://github.com/netlify/build/blob/master/packages/functions-utils/src/main.js#L60-L70 Notably, Instead, explicitly checking whether if (constants.FUNCTIONS_SRC === undefined || !(await pathExists(constants.FUNCTIONS_SRC))) {
return utils.build.failBuild('Failed to inline functions files because Netlify functions folder was not configured or pointed to a wrong folder, please check your configuration')
}
const netlifyFunctions = await utils.functions.listAll() |
hi @ehmicky, |
Good point! https://github.com/netlify/build/blob/master/packages/functions-utils/src/main.js#L60-L70 Based on this, I am wondering how I got the following behavior:
If you remove any error handling on this function, then try to build with a |
When the user has not specified any Functions directory, this plugin currently fails with:
or
However, this is reported as a plugin error. It would be better to report it as a user error using
utils.build.failBuild()
by checking at the beginning whetherconstants.FUNCTIONS_SRC
points to an existing directory (using for examplepath-exists
).The text was updated successfully, but these errors were encountered: