Skip to content

Commit bee2b20

Browse files
Merge pull request #6551 from segmentio/prigiattiperrut-patch-2
Update insert-functions.md
2 parents d40ccd7 + d3cfc4c commit bee2b20

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

src/connections/functions/insert-functions.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ You can also use this page to [enable destination insert functions](#enable-the-
4949

5050
## Code the destination insert function
5151

52+
> info ""
53+
> To prevent "Unsupported Event Type" errors, ensure your insert function handles all event types (page, track, identify, alias, group) that are expected to be sent to the destination. It is highly recommended to [test the function](https://segment.com/docs/connections/functions/insert-functions/#test-the-destination-insert-function) with each event type to confirm they are being handled as expected.
54+
5255
Segment invokes a separate part of the function (called a "handler") for each event type that you send to your destination insert function.
5356

5457
> info ""
@@ -497,6 +500,42 @@ Segment's data pipeline applies Destination Filters before invoking Insert Funct
497500

498501
There is an 120-Character limit for the insert function display name.
499502

503+
##### Why does the Event Delivery tab show "Unsupported Event Type" errors for events supported by the destination after I enabled an insert function?
504+
505+
This error occurs because your insert function code might not be handling all event types (Page, Track, Identify, Alias, Group) that your destination supports. When these unlisted events pass through the function, they are rejected with the "Unsupported Event Type" error.
506+
507+
To resolve this, verify your insert function includes handlers for all expected event types and returns the event object for each. Here’s an example of how you can structure your insert function to handle all event types:
508+
509+
```
510+
async function onTrack(event, settings) {
511+
//Return event to handle page event OR Your existing code for track event
512+
return event;
513+
}
514+
515+
async function onPage(event, settings) {
516+
//Return event to handle page event OR Your existing code for track event
517+
return event;
518+
}
519+
520+
async function onIdentify(event, settings) {
521+
//Return event to handle page event OR Your existing code for track event
522+
return event;
523+
}
524+
525+
async function onAlias(event, settings) {
526+
//Return event to handle page event OR Your existing code for track event
527+
return event;
528+
}
529+
530+
async function onGroup(event, settings) {
531+
//Return event to handle page event OR Your existing code for track event
532+
return event;
533+
}
534+
535+
// Ensure that all expected event types are included in your function
536+
```
537+
By including handlers for all the major event types, you ensure that all supported events are processed correctly, preventing the "Unsupported Event Type" error. Always test your updated code before implementing it in production.
538+
500539
{% comment %}
501540

502541
## Using Segment's Public API

0 commit comments

Comments
 (0)