-
Notifications
You must be signed in to change notification settings - Fork 79
feat!: use netlify/functions as the default functions directory #2188
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
Conversation
| const pRmdir = promisify(rmdir) | ||
|
|
||
| const DEFAULT_FUNCTIONS_SRC = 'netlify-automatic-functions' | ||
| const DEFAULT_FUNCTIONS_SRC_PARENT = 'netlify' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😖 This is super icky, but Node 8 does not support the recursive flag in fs.mkdir and this was the least terrible way of keeping the fixtures simple that I could think of. Any suggestions are more than welcome!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0c99646 is perhaps slightly less icky?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Another reason to drop Node 8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, thanks!
When should we merge and release this @verythorough? How much heads up should we give users with the current warnings in the build logs?
Other note: this PR should also be followed by an update to @netlify/plugin-nextjs with the new netlify/functions. Otherwise, @netlify/plugin-nextjs would break.
Done in opennextjs/opennextjs-netlify#87. |
|
Resulting from the discussion in opennextjs/opennextjs-netlify#87, I've added backward-compatibility with Current warning:
🔔 @ehmicky |
| }) { | ||
| await validateNetlifyDir(logs, buildDir) | ||
| // @todo Remove once we drop support for the legact default functions directory. | ||
| await checkForLegacyDefaultFunctionsDir(logs, buildDir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theoretically there's nothing stopping people from explicitcly defining netlify-automatic-functions in the config as being their functions directory, in which case this warning should not be printed. However, to achieve this we would need to move this logic to @netlify/config, because at this point we don't know whether functions was added by the user or by us.
@ehmicky do you have an opinion on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We ran some logs few weeks ago which confirmed that virtually no one was using netlify-automatic-functions since we have not documented it.
The main risk here is for users of @netlify/plugin-nextjs who installed it in their package.json. Those users will not know about netlify-automatic-functions since this is done under the hood. Instead, the way to fix this error would be for them to upgrade @netlify/plugin-nextjs (after we've released the new versions using netlify/functions).
I think this warning message is still safe to keep, but we might not need to move it to @netlify/config.
On the other hand, we might want to create an issue/PR to print a warning message in @netlify/build when a build is using the old version of @netlify/plugin-nextjs. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great! 🎉
When releasing this, we should make sure to test this in production together with the current version of @netlify/plugin-nextjs (the one still using neltify/functions).
In the related community update, we said February. As soon as dev and docs work is ready, we can release as early as next week. |
|
Oh, and pinging @rstavchansky for the copy review request. Thanks! |
|
@eduardoboucas Here's a suggested copy edit of the error. Feel free to adjust formatting as needed so it is readable in the output. Thank you for the ping @verythorough |
|
Perfect, thanks @rstavchansky! I'm sorry I didn't ping you initially, I'm still learning who's responsible for what. |
|
Perhaps you could fix the typo "non-exiting directory" at
|
|
The typo is fixed in #2236 (we should strive to keep PRs small and single-purposed). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tweak to the error message about the plug-in upgrade. The wording looks fine to me. 👍
Which problem is this pull request solving?
This PR makes
netlify/functionsthe default functions directory.List other issues or pull requests related to this problem
This closes #2016, https://github.com/netlify/product/issues/257, https://github.com/netlify/pod-the-builder/issues/91, and https://github.com/netlify/pod-the-builder/issues/89.
Additional details
@netlify/configdoes not assign the default functions directory unless it existsChecklist
Please add a
xinside each checkbox: