onPostBuild lifecycle event doesn't exist
See original GitHub issueDescribe the bug
I receive the following error when using a simple Netlify build plugin with the onPostBuild
lifecycle handler. I have been testing with the official sitemap plugin.
Error: Invalid lifecycle hook 'onPostBuild'.
Please use a valid event name. One of:
"init", "preGetCache", "getCache", "postGetCache", "preInstall", "install", "postInstall", "preBuild", "preFunctionsBuild", "functionsBuild", "postFunctionsBuild", "build", "postBuild", "prePackage", "package", "postPackage", "preDeploy", "preSaveCache", "saveCache", "postSaveCache", "finally", "onError"
Steps to reproduce
Environment:
> netlify --version
netlify-cli/2.25.0 darwin-x64 node-v12.11.0
I am using the latest version of Netlify Cli cloned from git and using npm link
so it can be used globally.
Install the netlify-plugin-sitemap
into a project or use the basic plugin code below and then run netlify build
, this command should throw the error.
module.exports = {
name: '@netlify/plugin-http2',
onPostBuild: async ({ constants, pluginConfig }) => {
console.log('POST BUILD');
}
};
Expected behavior
It should not report an error and the lifecycle event should be called at the correct point in the build. I assume this lifecycle method still exists as it is in the README.
Environment
npx: installed 1 in 3.39s
System:
OS: macOS 10.15.2
CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
Memory: 51.02 MB / 8.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.11.0 - ~/.nvm/versions/node/v12.11.0/bin/node
Yarn: 1.19.0 - /usr/local/bin/yarn
npm: 6.13.4 - ~/.nvm/versions/node/v12.11.0/bin/npm
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
error "gatsby-plugin-manifest" threw an error while running the ...
Failed at the gatsby-starter-default@0.1.0 build script. 20:49:09.617 | npm ERR! This is probably not a problem with npm. There is likely ...
Read more >Gatsby Node APIs
You can use its APIs to create pages dynamically, add data into GraphQL, or respond to events during the build lifecycle. To use...
Read more >Apollo Server plugin event reference - Apollo GraphQL Docs
This reference describes the lifecycle events that your custom Apollo Server plugin ... The server doesn't start until this asynchronous method completes.
Read more >App lifecycle - .NET MAUI | Microsoft Learn
NET MAUI raises cross-platform lifecycle events when an app transitions between its different execution states.
Read more >Activity | Android Developers
On this page; Developer Guides; Fragments; Activity Lifecycle; Configuration Changes ... Returns. Object, The service or null if the name does not exist....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry to waste your time, after clearing
node_modules
andpackage-lock.json
and reinstalling everything has started working.No worries! Feel free to post any issues you might encounter 😃