Documentation for Serverless Events

Forgive the rant (yall know I love you), but I’m disappointed to see that the docs for serverless events (Trigger functions on events | Netlify Docs) still do not contain information about what is found in the payload. I first noticed this issue last year when I first tried to test the feature, Customized Form Handling on Netlify with Serverless Functions. A few days ago I worked with the “deploy-succeeded” event for the first time and was really surprised to see this still hasn’t been addressed.

Yes you can console.log - but as you can’t (afaik) test these events with netlify dev, it means committing your code, running the event, checking the function logs, copying the data and perhaps formatting it so you can actually read it, and so forth. This is something I shouldn’t have to do if it was properly documented.

Please, please, take the time to document the payload values. Heck, if the docs in a public repo I’ll gladly make a PR to add these myself.

Note, found this thread from 5 or so months ago that didn’t get an update: Event Triggered Functions Docs

2 Likes

We have an open issue for this, but other docs additions and improvements have taken higher priority. I’ll link this topic in the issue and be sure to post here when it’s closed.

Thank you. I’m happy to help review if you need an extra set of eyes before publication.

Has there been any update on this? It’s on my mind as Brian Rinaldi wrote a good article on forms (A Complete Guide to Netlify Forms - Stackbit) and there’s still no documentation of the data sent to the function.

1 Like

I can reiterate that I did run into this issue as well when trying to build the function. Currently, users are pointed at a slightly old blog post that doesn’t detail this.

No update yet I’m afraid. We know this is not ideal but please know its not fallen off our radar completely! Its in the backlog which means as of today we intend to get to it.

Many thanks for your patience. I wish we had more conclusive news for you, but this is where we’re at today.

1 Like

Just adding my name here :slight_smile: I agree that this is a pain point. Local dev has functions:invoke which only includes a payload shape (mock data) for Identify functions (as pointed out by @cfjedimaster in our massive Identity Thread) but getting an idea of data shapes for Functions across the board is difficult. Not impossible, but not conducive to a solid Dev Experience :100:


Jon

Hello from seven (7) months later. This post is still all I found while looking for the shape of the payload for deploy-succeeded :disappointed:

In the meantime, is there any other way I can get this info? I specifically want to know the deploy preview URL and the branch name from deploy-succeeded.

Update: you can push a function and console.log out the event.body. Doing so revelead the answer to my question: body.branch and body.deploy_ssl_url, respectively. Or maybe body.links.permalink would be better to use is my case – this is the kind of thing documentation would clear up, too!

1 Like

Hey there, @mfan :wave:

Thank you for sharing the workaround you used! I have shared your feedback with the team who is working on this issue.