Function not triggered on deploy-succeeded

I want to use event-triggered function to notify other service I use that a new version of my site has been deployed. The deploy-succeeded.js I wrote is pretty simple, so I place its dependency inside package.json in the root directory of my project and want to deploy “unbundled JavaScript functions” directly. The current layout of it follows:

├── functions
│   └── deploy-succeeded.js
├── netlify.toml
├── package.json
├── ...

In the deploy log, I can see entries like Prepping functions with zip-it-and-ship-it 0.3.1 and 1 new functions to upload. My site is now deployed, and “deploy-succeeded.js” can be seen in the “Functions” panel of my site. However, its function log is empty with only a spinning cursor. The remote service didn’t receive any request, either.

That function can be triggered locally after netlify dev with curl, which can be confirmed by logs in terminal generated by console.log().

Would love to know if I made any mistake in configuring Netlify functions, and how can I debug these event-triggered ones.

Hey @capuohig,

Have you configured this script with a correctly formatted payload?

That simple script I wrote follows the structure of

and the parameter event isn’t actually used in my code, so I assume it’s not related to the payload passed by the invoker.

The script should print something to the console with console.log() once it’s executed, hence I feel quite confused.

UPDATE: Just tried raplacing my script with the sample script above, and the result seems unchanged. There is still only a spinning cursor in the function log box.

Sounds like you’re doing all the right things! Could you please share your Netlify site name so we can dig in further?

In the meantime, I’m a little confused that we’re building your functions with zip-it-and-ship-it 0.3.1… the latest version is 0.4.0 :face_with_monocle: One other thing to try would be enabling Build Plugins beta on that site to get the most up-to-date dependency versions:

This problem is gone after creating a new site in the dashboard.
Nevertheless thank you for your great product.

1 Like