Skip to content

Use new default functions directory #87

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

Merged
merged 1 commit into from
Feb 4, 2021
Merged

Conversation

eduardoboucas
Copy link
Member

With netlify/build#2188, the default functions directory will be netlify/functions. This PR updates the plugin accordingly.

@eduardoboucas eduardoboucas added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Jan 21, 2021
@lindsaylevine
Copy link

hey @eduardoboucas ! will this be backwards compatible by chance? i.e. if build releases first and the plugin tries to run on a site before the plugin can release aka while the plugin still has the old const defined. coordinating releases might be tricky though shouldnt be too risky if we're in sync enough :)

@eduardoboucas
Copy link
Member Author

Hey @lindsaylevine! As far as I know, there are no plans of making this backwards-compatible (i.e. to still honour the netlify-automatic-functions directory if it exists), but I'm pinging @ehmicky because he has more context on this than I do.

I think we could make this backwards-compatible, but it would add some complexity, so perhaps let's discuss how best to sync the release process to avoid it?

Thanks! 🙌🏻

@lindsaylevine
Copy link

@eduardoboucas gotcha ok sounds good! just occurred to me as well that some people may have the plugin installed/locked at a specific version in which case their builds will still have netlify-automatic-functions and build will be out of sync

@ehmicky
Copy link

ehmicky commented Jan 21, 2021

Good point @lindsaylevine!

This PR requires @netlify/plugin-nextjs to be run with a version of @netlify/build (not released yet) using the new netlify/functions/ name. Otherwise, Function files will be created but not bundled nor deployed.

The initial idea was to release @netlify/plugin-nextjs (i.e. merge PR in netlify/plugins) and @netlify/build (i.e. release the buildbot) at approximately the same time. However, there might be some shortcomings:

  • Those two events won't happen at the exact same time, which will make build fails for few minutes
  • Releasing @netlify/plugin-nextjs in netlify/plugins will not upgrade it for users who installed it in their package.json

It seems to me the only solution to this would be keep supporting netlity-automatic-functions (in addition to netlify/functions) in @netlify/build, for backward compatibility. After releasing @netlify/build, then we could make this change in @netlify/plugin-nextjs.

A separate potential problem: the new value netlify/functions includes a sub-directory, which might not exist yet. Would that be a problem with next-on-netlify?

@eduardoboucas
Copy link
Member Author

Good point indeed, I didn't consider that.

It seems to me the only solution to this would be keep supporting netlity-automatic-functions (in addition to netlify/functions) in @netlify/build

I agree. I'm happy to handle that.

@lindsaylevine
Copy link

A separate potential problem: the new value netlify/functions includes a sub-directory, which might not exist yet. Would that be a problem with next-on-netlify?

jeez i hope not 😂 i think our unit tests would have caught this though, right?

@verythorough
Copy link

Do you think we could set an "end of support" date for the plugin versions that require netlify-automatic-functions? It doesn't have to be particularly soon, but it would be nice if we could set a date when we could remove that backwards-compatibility.

@eduardoboucas
Copy link
Member Author

Do you think we could set an "end of support" date for the plugin versions that require netlify-automatic-functions? It doesn't have to be particularly soon, but it would be nice if we could set a date when we could remove that backwards-compatibility.

Sorry @verythorough, I missed your comment somehow. I created an issue for this at netlify/build#2252, since removing the backwards-compatibility would happen on the Build side.

@ehmicky ehmicky merged commit e54441e into main Feb 4, 2021
@ehmicky ehmicky deleted the eb/new-functions-dir branch February 4, 2021 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants