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:
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 http://127.0.0.1:34567/.netlify/functions/deploy-succeeded, 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.
Hi,
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 One other thing to try would be enabling Build Plugins beta on that site to get the most up-to-date dependency versions: