You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/_includes/content/functions/perms.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@ Functions have specific roles which can be used for [access management](/docs/se
2
2
3
3
Access to functions is controlled by two permissions [roles](/docs/segment-app/iam/roles/):
4
4
5
-
-**Functions Admin:** Create, edit and delete all functions, or a subset of specified functions.
5
+
-**Functions Admin:** Create, edit, and delete all functions, or a subset of specified functions.
6
6
-**Functions Read-only:** View all functions, or a subset of specified functions.
7
7
8
8
You also need additional **Source Admin** permissions to enable source functions, connect destination functions to a source, or to deploy changes to existing functions.
Copy file name to clipboardExpand all lines: src/_includes/content/functions/runtime.md
+32-28Lines changed: 32 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,35 +1,35 @@
1
1
Functions use Node.js 14.x.
2
2
3
-
Functions do not currently support importing dependencies, but you can [contact Segment Support](https://segment.com/help/contact/) to request that one be added.
3
+
Functions do not currently support importing dependencies, but you can [contact Segment Support](https://segment.com/help/contact/){:target="_blank"} to request that one be added.
4
4
5
5
The following dependencies are installed in the function environment by default.
6
6
7
-
-[`atob v2.1.2`](https://www.npmjs.com/package/atob) exposed as `atob`
8
-
-[`aws-sdk v2.488.0`](https://www.npmjs.com/package/aws-sdk) exposed as `AWS`
9
-
-[`btoa v1.2.1`](https://www.npmjs.com/package/btoa) exposed as `btoa`
10
-
-[`form-data v2.4.0`](https://www.npmjs.com/package/form-data) exposed as `FormData`
11
-
-[`@google-cloud/automl v2.2.0`](https://www.npmjs.com/package/@google-cloud/automl) exposed as `google.cloud.automl`
12
-
-[`@google-cloud/bigquery v5.3.0`](https://www.npmjs.com/package/@google-cloud/bigquery) exposed as `google.cloud.bigquery`
13
-
-[`@google-cloud/datastore v6.2.0`](https://www.npmjs.com/package/@google-cloud/datastore) exposed as `google.cloud.datastore`
14
-
-[`@google-cloud/firestore v4.4.0`](https://www.npmjs.com/package/@google-cloud/firestore) exposed as `google.cloud.firestore`
15
-
-[`@google-cloud/functions v1.1.0`](https://www.npmjs.com/package/@google-cloud/functions) exposed as `google.cloud.functions`
16
-
-[`@google-cloud/pubsub v2.6.0`](https://www.npmjs.com/package/@google-cloud/pubsub) exposed as `google.cloud.pubsub`
17
-
-[`@google-cloud/storage v5.3.0`](https://www.npmjs.com/package/@google-cloud/storage) exposed as `google.cloud.storage`
18
-
-[`jsforce v1.11.0`](https://www.npmjs.com/package/jsforce) exposed as `jsforce`
19
-
-[`jsonwebtoken v8.5.1`](https://www.npmjs.com/package/jsonwebtoken) exposed as `jsonwebtoken`
20
-
-[`lodash v4.17.15`](https://www.npmjs.com/package/lodash) exposed as `_`
21
-
-[`moment v2.26.0`](https://www.npmjs.com/package/moment/v/2.26.0) exposed as `moment`
22
-
-[`node-fetch v2.6.0`](https://www.npmjs.com/package/node-fetch) exposed as `fetch`
23
-
-[`oauth v0.9.15`](https://www.npmjs.com/package/oauth) exposed as `OAuth`
24
-
-[`@sendgrid/client v7.4.7`](https://www.npmjs.com/package/@sendgrid/client) exposed as `sendgrid.client`
25
-
-[`@sendgrid/mail v7.4.7`](https://www.npmjs.com/package/@sendgrid/mail) exposed as `sendgrid.mail`
26
-
-[`stripe v8.115.0`](https://www.npmjs.com/package/stripe) exposed as `stripe`
27
-
-[`twilio v3.68.0`](https://www.npmjs.com/package/twilio) exposed as `twilio`
28
-
-[`uuidv5 v1.0.0`](https://www.npmjs.com/package/uuidv5) exposed as `uuidv5`
29
-
-[`xml v1.0.1`](https://www.npmjs.com/package/xml) exposed as `xml`
30
-
-[`xml2js v0.4.23`](https://www.npmjs.com/package/xml2js) exposed as `xml2js`
31
-
-[`zlib v1.0.5`](https://www.npmjs.com/package/zlib) exposed as `zlib.zlib`
32
-
7
+
-[`atob v2.1.2`](https://www.npmjs.com/package/atob){:target="_blank"} exposed as `atob`
8
+
-[`aws-sdk v2.488.0`](https://www.npmjs.com/package/aws-sdk){:target="_blank"} exposed as `AWS`
9
+
-[`btoa v1.2.1`](https://www.npmjs.com/package/btoa){:target="_blank"} exposed as `btoa`
10
+
-[`form-data v2.4.0`](https://www.npmjs.com/package/form-data){:target="_blank"} exposed as `FormData`
11
+
-[`@google-cloud/automl v2.2.0`](https://www.npmjs.com/package/@google-cloud/automl){:target="_blank"} exposed as `google.cloud.automl`
12
+
-[`@google-cloud/bigquery v5.3.0`](https://www.npmjs.com/package/@google-cloud/bigquery){:target="_blank"} exposed as `google.cloud.bigquery`
13
+
-[`@google-cloud/datastore v6.2.0`](https://www.npmjs.com/package/@google-cloud/datastore){:target="_blank"} exposed as `google.cloud.datastore`
14
+
-[`@google-cloud/firestore v4.4.0`](https://www.npmjs.com/package/@google-cloud/firestore){:target="_blank"} exposed as `google.cloud.firestore`
15
+
-[`@google-cloud/functions v1.1.0`](https://www.npmjs.com/package/@google-cloud/functions){:target="_blank"} exposed as `google.cloud.functions`
16
+
-[`@google-cloud/pubsub v2.6.0`](https://www.npmjs.com/package/@google-cloud/pubsub){:target="_blank"} exposed as `google.cloud.pubsub`
17
+
-[`@google-cloud/storage v5.3.0`](https://www.npmjs.com/package/@google-cloud/storage){:target="_blank"} exposed as `google.cloud.storage`
18
+
-[`jsforce v1.11.0`](https://www.npmjs.com/package/jsforce){:target="_blank"} exposed as `jsforce`
19
+
-[`jsonwebtoken v8.5.1`](https://www.npmjs.com/package/jsonwebtoken){:target="_blank"} exposed as `jsonwebtoken`
20
+
-[`lodash v4.17.19`](https://www.npmjs.com/package/lodash){:target="\_blank"} exposed as `_`
21
+
-[`moment-timezone v0.5.31`](https://www.npmjs.com/package/moment-timezone/v/0.5.31){:target="_blank"} exposed as `moment`
22
+
-[`node-fetch v2.6.0`](https://www.npmjs.com/package/node-fetch){:target="_blank"} exposed as `fetch`
23
+
-[`oauth v0.9.15`](https://www.npmjs.com/package/oauth){:target="_blank"} exposed as `OAuth`
24
+
-[`@sendgrid/client v7.4.7`](https://www.npmjs.com/package/@sendgrid/client){:target="_blank"} exposed as `sendgrid.client`
25
+
-[`@sendgrid/mail v7.4.7`](https://www.npmjs.com/package/@sendgrid/mail){:target="_blank"} exposed as `sendgrid.mail`
26
+
-[`stripe v8.115.0`](https://www.npmjs.com/package/stripe){:target="_blank"} exposed as `stripe`
27
+
-[`twilio v3.68.0`](https://www.npmjs.com/package/twilio){:target="_blank"} exposed as `twilio`
28
+
-[`uuidv5 v1.0.0`](https://www.npmjs.com/package/uuidv5){:target="_blank"} exposed as `uuidv5`
29
+
-[`xml v1.0.1`](https://www.npmjs.com/package/xml){:target="_blank"} exposed as `xml`
30
+
-[`xml2js v0.4.23`](https://www.npmjs.com/package/xml2js){:target="_blank"} exposed as `xml2js`
31
+
-[`zlib v1.0.5`](https://www.npmjs.com/package/zlib){:target="_blank"} exposed as `zlib.zlib`
32
+
33
33
`zlib`'s asynchronous methods `inflate` and `deflate` must be used with `async` or `await`. For example:
34
34
35
35
```js
@@ -53,7 +53,11 @@ The following dependencies are installed in the function environment by default.
53
53
}
54
54
```
55
55
56
-
Only the [`crypto`Node.jsmodule](https://nodejs.org/dist/latest-v10.x/docs/api/crypto.html ) is included (exposed as `crypto`). [Other built-in Node.js modules](https://nodejs.org/api/modules.html) are not available.
56
+
The following Node.js modules are available:
57
+
- [`crypto`Node.jsmodule](https://nodejs.org/dist/latest-v10.x/docs/api/crypto.html ){:target="_blank"} exposed as `crypto`.
58
+
- [`https`Node.jsmodule](https://nodejs.org/api/https.html){:target="_blank"} exposed as `https`.
Copy file name to clipboardExpand all lines: src/connections/destinations/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -137,7 +137,7 @@ All mobile libraries handle retries by periodically attempting to flush their in
137
137
138
138
#### Retries between Segment and destinations
139
139
140
-
The destination endpoint APIs have fluctuations in availability due to a number of issues ranging from network failures to bugs to overload. Segment's internal systems retry failed destination API calls for 4 hours with a randomize exponential backoff after each attempt. This substantially improves delivery rates.
140
+
The destination endpoint APIs have fluctuations in availability due to a number of issues ranging from network failures to bugs to overload. Segment's internal systems retry failed destination API calls for four hours with a randomized exponential backoff after each attempt. This substantially improves delivery rates.
141
141
142
142
Here's an example destination that was only successfully accepting 93.36% of all API requests but was achieving a 99.28% final deliverability rate due to Segment's retry functionality.
Copy file name to clipboardExpand all lines: src/connections/functions/destination-functions.md
+9-6Lines changed: 9 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,14 +21,15 @@ All functions are scoped to your workspace, so members of other workspaces can't
21
21
22
22
## Create a destination function
23
23
24
-
1. From your workspace, go to the Catalog and click the [Functions tab](https://app.segment.com/goto-my-workspace/functions/catalog){:target="_blank"}.
24
+
1. From your workspace, go to **Connections > Catalog** and click the [Functions tab](https://app.segment.com/goto-my-workspace/functions/catalog){:target="_blank"}.
25
25
2. Click **New Function**.
26
-
3. Select **Destination Function** and click **Build**.
26
+
3. Select **Destination** as the function type and click **Build**.
27
+
28
+
After you click **Build**, a code editor appears. Use the editor to write the code for your function, configure settings, and test the function's behavior.
27
29
28
30
> success ""
29
31
> **Tip:** Want to see some example functions? Check out the templates available in the Functions UI, or in the open-source [Segment Functions Library](https://github.com/segmentio/functions-library){:target="_blank"}. (Contributions welcome!)
30
32
31
-
When you click **Build**, a code editor appears. Use the editor to write the code for your function, configure settings, and test the function's behavior.
32
33
33
34
## Code the destination function
34
35
@@ -352,7 +353,7 @@ A function can throw errors, or Segment might encounter errors while invoking yo
352
353
-**Bad Request** - Any error thrown by the function code that is not covered by the other errors.
353
354
-**Invalid Settings** - A configuration error prevented Segment from executing your code. If this error persists for more than an hour, [contact Segment Support](https://segment.com/help/contact/){:target="_blank"}.
354
355
-**Message Rejected** - Your code threw `InvalidEventPayload` or `ValidationError` due to invalid input.
355
-
-**Unsupported Event Type** - Your code doesn't implement a specific event type (for example, `onTrack()`) or threw a`EventNotSupported` error.
356
+
-**Unsupported Event Type** - Your code doesn't implement a specific event type (for example, `onTrack()`) or threw an`EventNotSupported` error.
356
357
-**Retry** - Your code threw `RetryError` indicating that the function should be retried.
357
358
358
359
Segment only attempts to send the event to your destination function again if a **Retry** error occurs.
@@ -442,7 +443,7 @@ In addition to using [Destination Filters](/docs/connections/destinations/destin
442
443
...
443
444
```
444
445
445
-
In the example above, the integrations object directly references and enables the `My Destination Function`. Be sure to include the workspace name in which the Destination Function is created, as shown. Like all items in the integration object, Destination Functions (and workspace names) are case sensitive.
446
+
In the example above, the integrations object directly references and enables the `My Destination Function`. Be sure to include the workspace name in which the destination function is created, as shown. Like all items in the integration object, destination functions (and workspace names) are case sensitive.
446
447
447
448
## Destination functions FAQs
448
449
@@ -452,7 +453,9 @@ Yes, Functions access is logged in the [Audit Trail](/docs/segment-app/iam/audit
452
453
453
454
##### Does Segment retry failed function invocations?
454
455
455
-
Segment retries invocations that throw RetryError or Timeout errors for up to four hours. Segment does not retry if your function throws a [non-recoverable error](#errors-and-error-handling).
456
+
Yes, Segment retries invocations that throw RetryError or Timeout errors (temporary errors only). Segment's internal system retries failed functions API calls for four hours with a randomized exponential backoff after each attempt. This substantially improves delivery rates.
457
+
458
+
[Retries](/docs/connections/destinations/#retries-between-segment-and-destinations) work the same for both functions and cloud-mode destinations in Segment.
456
459
457
460
##### Are events guaranteed to send data in order?
Copy file name to clipboardExpand all lines: src/connections/functions/environment.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Segment Functions create reusable code that can be run in your Segment workspace
8
8
When you create a function, write code for it, and save it, the function appears in the Catalog in your workspace _only_. You can then deploy that function in your workspace just as you would a conventional source or destination.
9
9
10
10
> note ""
11
-
> Access to Functions is controlled by specific [access management roles](#functions-permissions). You may need additional access to create, and deploy functions.
11
+
> Access to Functions is controlled by specific [access management roles](#functions-permissions). You may need additional access to create and deploy functions.
12
12
13
13
14
14
## Creating functions
@@ -29,7 +29,7 @@ After you click **Create Function**, the function appears on the [Functions cata
29
29
30
30
## Editing a function
31
31
32
-
If you are a **Workspace Owner** or **Functions Admin**, you can manage your function from the [Functions catalog page](https://app.segment.com/goto-my-workspace/functions/catalog/).
32
+
If you are a **Workspace Owner** or **Functions Admin**, you can manage your function from the [Functions catalog page](https://app.segment.com/goto-my-workspace/functions/catalog/){:target="_blank"}.
33
33
34
34
If you're editing an existing function, you can **Save** changes without changing the behavior of existing instances of the function.
35
35
@@ -58,10 +58,10 @@ When you deploy your destination function in your workspace, you fill out the se
Copy file name to clipboardExpand all lines: src/connections/functions/index.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,15 +5,15 @@ title: Functions Overview
5
5
Functions let you create your own sources and destinations directly within your workspace to bring new types of data into Segment and send data to new tools with just a few lines of JavaScript - no additional infrastructure required.
6
6
7
7
> info ""
8
-
> Functions is available to all customer plan types with a free allotment of usage hours. Read more about [Functions usage limits](/docs/connections/functions/usage/), or see [your workspace's Functions usage stats](https://app.segment.com/goto-my-workspace/settings/usage?metric=functions).
8
+
> Functions is available to all customer plan types with a free allotment of usage hours. Read more about [Functions usage limits](/docs/connections/functions/usage/), or see [your workspace's Functions usage stats](https://app.segment.com/goto-my-workspace/settings/usage?metric=functions){:target="_blank"}.
9
9
10
10

11
11
12
12
## What can you do with Functions?
13
-
Functions can help you bring external data into Segment ([Source Functions](/docs/connections/functions/source-functions)) and send data in Segment out to external destinations ([Destination Functions](/docs/connections/functions/destination-functions)). Functions are scoped to your specific workspace. If you're a technology partner and want to build a new integration and publish it in Segment's catalog, see the [Developer Center documentation](/docs/partners/).
13
+
Functions can help you bring external data into Segment ([Source functions](/docs/connections/functions/source-functions)) and send data in Segment out to external destinations ([Destination functions](/docs/connections/functions/destination-functions)). Functions are scoped to your specific workspace. If you're a technology partner and want to build a new integration and publish it in Segment's catalog, see the [Developer Center documentation](/docs/partners/).
14
14
15
-
#### Source Functions
16
-
Source Functions receive external data from a webhook and can create Segment events, objects, or both. Source Functions have access to the full power of JavaScript so you can validate and transform the incoming data and even make external API requests to annotate your data.
15
+
#### Source functions
16
+
Source functions receive external data from a webhook and can create Segment events, objects, or both. Source functions have access to the full power of JavaScript so you can validate and transform the incoming data and even make external API requests to annotate your data.
17
17
18
18
Use cases:
19
19
- Ingest data into Segment from a source that's unavailable in the catalog
@@ -22,8 +22,8 @@ Use cases:
22
22
23
23
Learn more about [source functions](/docs/connections/functions/source-functions).
24
24
25
-
#### Destination Functions
26
-
Destination Functions can take events from a Segment source, transform the events, and deliver them to external APIs. Destination Functions can make arbitrary requests to annotate data, as well.
25
+
#### Destination functions
26
+
Destination functions can take events from a Segment source, transform the events, and deliver them to external APIs. Destination functions can make arbitrary requests to annotate data, as well.
27
27
28
28
Use cases:
29
29
- Send data from Segment to a service that's unavailable in the catalog
0 commit comments