Access Build Webhook payload in 'deploy-succeeded.js'

Thanks for clarifying!

I don’t know a direct way to get it to your function as you prefer; you cannot change how we invoke that function, and we don’t forward that data, as you’ve discovered.

You could use a pattern like this:

  • deploy the contents in a file,
  • since they are available during build as $WEBHOOK_BODY,
  • which you could choose to add to your code,
  • and deploy with your site.
  • Finally, the deploy-succeeded event-triggered function could go look at the file contents while it runs, since you’ll know the URL you just left those contents at. Heck, you could even write them RIGHT INTO THE FUNCTION CODE if you want to :smiley:

This article explains that pattern of interpolating env vars into code at run time:

[Support Guide] Using environment variables on Netlify correctly (most relevant part for you, starts in the 4th paragraph)