Skip to content

Commit 51263c4

Browse files
authored
Merge pull request #621 from segmentio/repo-sync
repo sync
2 parents cb0a6b4 + 5868e72 commit 51263c4

File tree

7 files changed

+60
-52
lines changed

7 files changed

+60
-52
lines changed

src/_includes/content/functions/perms.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Functions have specific roles which can be used for [access management](/docs/se
22

33
Access to functions is controlled by two permissions [roles](/docs/segment-app/iam/roles/):
44

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.
66
- **Functions Read-only:** View all functions, or a subset of specified functions.
77

88
You also need additional **Source Admin** permissions to enable source functions, connect destination functions to a source, or to deploy changes to existing functions.

src/_includes/content/functions/runtime.md

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
Functions use Node.js 14.x.
22

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.
44

55
The following dependencies are installed in the function environment by default.
66

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+
3333
`zlib`'s asynchronous methods `inflate` and `deflate` must be used with `async` or `await`. For example:
3434

3535
```js
@@ -53,7 +53,11 @@ The following dependencies are installed in the function environment by default.
5353
}
5454
```
5555

56-
Only the [`crypto` Node.js module](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.js module](https://nodejs.org/dist/latest-v10.x/docs/api/crypto.html ){:target="_blank"} exposed as `crypto`.
58+
- [`https` Node.js module](https://nodejs.org/api/https.html){:target="_blank"} exposed as `https`.
59+
60+
[Other built-in Node.js modules](https://nodejs.org/api/modules.html){:target="_blank"} aren't available.
5761

5862
For more information on using the `aws-sdk` module, see how to [set up functions for calling AWS APIs](/docs/connections/functions/aws-apis/).
5963

src/connections/destinations/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ All mobile libraries handle retries by periodically attempting to flush their in
137137

138138
#### Retries between Segment and destinations
139139

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.
141141

142142
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.
143143

src/connections/functions/destination-functions.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ All functions are scoped to your workspace, so members of other workspaces can't
2121
2222
## Create a destination function
2323

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"}.
2525
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.
2729

2830
> success ""
2931
> **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!)
3032
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.
3233

3334
## Code the destination function
3435

@@ -352,7 +353,7 @@ A function can throw errors, or Segment might encounter errors while invoking yo
352353
- **Bad Request** - Any error thrown by the function code that is not covered by the other errors.
353354
- **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"}.
354355
- **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.
356357
- **Retry** - Your code threw `RetryError` indicating that the function should be retried.
357358

358359
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
442443
...
443444
```
444445

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.
446447

447448
## Destination functions FAQs
448449

@@ -452,7 +453,9 @@ Yes, Functions access is logged in the [Audit Trail](/docs/segment-app/iam/audit
452453

453454
##### Does Segment retry failed function invocations?
454455

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.
456459

457460
##### Are events guaranteed to send data in order?
458461

src/connections/functions/environment.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Segment Functions create reusable code that can be run in your Segment workspace
88
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.
99

1010
> 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.
1212
1313

1414
## Creating functions
@@ -29,7 +29,7 @@ After you click **Create Function**, the function appears on the [Functions cata
2929

3030
## Editing a function
3131

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"}.
3333

3434
If you're editing an existing function, you can **Save** changes without changing the behavior of existing instances of the function.
3535

@@ -58,10 +58,10 @@ When you deploy your destination function in your workspace, you fill out the se
5858

5959
{% include content/functions/perms.md%}
6060

61-
## ️Settings and Secrets
61+
## ️Settings and secrets
6262

6363
{% include content/functions/settings.md %}
6464

65-
## Runtime and Dependencies
65+
## Runtime and dependencies
6666

6767
{% include content/functions/runtime.md %}

src/connections/functions/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ title: Functions Overview
55
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.
66

77
> 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"}.
99
1010
![An image illustrating source functions and destination functions in a Segment workspace](images/functions_overview.png)
1111

1212
## 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/).
1414

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.
1717

1818
Use cases:
1919
- Ingest data into Segment from a source that's unavailable in the catalog
@@ -22,8 +22,8 @@ Use cases:
2222

2323
Learn more about [source functions](/docs/connections/functions/source-functions).
2424

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.
2727

2828
Use cases:
2929
- Send data from Segment to a service that's unavailable in the catalog

0 commit comments

Comments
 (0)