Skip to content

function-utils README is misleading #1697

@maxime-michel

Description

@maxime-michel

It's been two months since I last encountered this, so I don't remember all the details, sorry. But it's been in my TODO list since then and I believe it is helfpul I nevertheless report the following:

The following snippet in functions-utils README.md is misleading:

module.exports = {
  // Add a Netlify Functions file or directory to a build
  async onPostBuild({ utils }) {
    await utils.functions.add('./path/to/function')
  },
}

The problem that I remember running into was that onPostBuild was too late to add the function. Only when switching to onPreBuild did the scenario work. Could you please confirm if you actually meant to use this event in the README?

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugcode to address defects in shipped code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions