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/runtime.md
+3-16Lines changed: 3 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,10 @@
1
-
On March 26, 2024, Segment is upgrading the Functions runtime environment to Node.js v18, which is the current long-term support (LTS) release.
1
+
On March 26, 2024, Segment upgraded the Functions runtime environment to Node.js v18, which is the current long-term support (LTS) release.
2
2
3
3
This upgrade keeps your runtime current with industry standards. Based on the [AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html){:target="_blank"} and [Node.js](https://nodejs.org/en/about/previous-releases){:target="_blank"} support schedule, Node.js v16 is no longer in *Maintenance LTS*. Production applications should only use releases of Node.js that are in *Active LTS* or *Maintenance LTS*.
4
4
5
-
All new functions will use Node.js v18 starting March 26, 2024.
5
+
For existing functions, this change automatically occurs as you update and deploy an existing function. Segment recommends that you check your function post-deployment to ensure everything's working. Your function may face issues due to the change in syntax between different Node.js versions and dependency compatibility.
6
6
7
-
For existing functions, this change automatically occurs as you update and deploy an existing function. Segment recommends that you check your function post-deployment to ensure everything's working. Your function may face issues due to the change in sytax between different Node.js versions and dependency compatibility.
8
-
9
-
<divclass="premonition warning"><divclass="fa fa-check-square"></div><divclass="content"><pclass="header">Limited time opt-out option </p><pmarkdown=1>
10
-
If you need more time to prepare, you can opt out of the update before March 19, 2024. <br><br> Note that if you opt out: <br>
11
-
- The existing functions will continue working on Node.js v16. <br>
12
-
- You won't be able to create new functions after July 15, 2024. <br>
13
-
- You won't be able to update existing functions after August 15, 2024. <br>
14
-
- You won't receive future bug fixes, enhancements, and dependency updates to the functions runtime. <br><br>
15
-
[Contact Segment](https://segment.com/help/contact/){:target="_blank"} to opt-out or with any questions. </p></div></div>
16
-
17
-
18
-
<divclass="premonition success"><divclass="fa fa-check-square"></div><divclass="content"><pclass="header">Node.js 18 </p><pmarkdown=1>Segment strongly recommends updating to Node.js v18 to benefit from future runtime updates, the latest security, and performance improvements.</p></div></div>
19
-
20
-
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.
7
+
Functions don't currently support importing dependencies, but you can [contact Segment Support](https://segment.com/help/contact/){:target="_blank"} to request that one be added.
21
8
22
9
The following dependencies are installed in the function environment by default.
Copy file name to clipboardExpand all lines: src/_includes/content/functions/settings.md
+6-8Lines changed: 6 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,15 @@
2
2
3
3
Settings allow you to pass configurable variables to your function, which is the best way to pass sensitive information such as security tokens. For example, you might use `settings` as placeholders to use information such as an API endpoint and API key. This way, you can use the same code with different settings for different purposes. When you deploy a function in your workspace, you are prompted to fill out these settings to configure the function.
4
4
5
-
First, add a setting in **Settings** tab in the code editor:
5
+
To use settings:
6
6
7
-
{:width="500"}
7
+
1. Add a setting in the **Settings**tab in the code editor:
8
8
9
-
Click **Add Setting** to add your new setting.
9
+
{:width="500"}
10
10
11
-

11
+
2. Click **Add Setting** to add your new setting.
12
12
13
-
You can configure the details about this setting, which change how it's displayed to anyone using your function:
13
+
3. Configure the details about this setting, which change how it's displayed to anyone using your function:
14
14
15
15
-**Label** - Name of the setting, which users see when configuring the function.
16
16
-**Name** - Auto-generated name of the setting to use in function's source code.
@@ -21,8 +21,6 @@ You can configure the details about this setting, which change how it's displaye
21
21
22
22
As you change the values, a preview to the right updates to show how your setting will look and work.
23
23
24
-
Click **Add Setting** to save the new setting.
24
+
4.Click **Add Setting** to save the new setting.
25
25
26
26
Once you save a setting, it appears in the **Settings** tab for the function. You can edit or delete settings from this tab.
27
-
28
-
{:width="500"}
Use Destination Insert Functions to enrich, transform, or filter your data before it reaches downstream destinations.
7
7
8
-
**Implement advanced data computation**: Write custom computation, operations, and business logic on streaming data that you send to downstream destinations.
8
+
With Destination Insert Functions you can:
9
+
***Implement advanced data computation**: Write custom computation, operations, and business logic on streaming data that you send to downstream destinations.
10
+
***Enrich your data**: Use destination insert functions with Segment's Profile API or third party sources to add additional context to your data and create personalized customer experiences.
11
+
***Support data compliance**: Use destination insert functions to support data masking, encryption, decryption, improved PII data handling, and tokenization.
12
+
***Customize filtration for your destinations**: Create custom logic with nested if-else statements, regex, custom business rules, and more to filter event data.
9
13
10
-
**Enrich your data**: Use destination insert functions with Segment's Profile API or third party sources to add additional context to your data and create personalized customer experiences.
11
-
12
-
**Support data compliance**: Use destination insert functions to support data masking, encryption, decryption, improved PII data handling, and tokenization.
13
-
14
-
**Customize filtration for your destinations**: Create custom logic with nested if-else statements, regex, custom business rules, and more to filter event data.
15
-
16
-
> info "Destination Insert Functions are not compatible with IP Allowlisting"
14
+
> info "Destination Insert Functions aren't compatible with IP Allowlisting"
17
15
> For more information, see the [IP Allowlisting](/docs/connections/destinations/#ip-allowlisting) documentation.
18
16
19
17
## Create destination insert functions
@@ -80,7 +78,7 @@ Insert functions can define handlers for each message type in the [Segment spec]
80
78
81
79
Each of the functions above accepts two arguments:
82
80
83
-
-**event** - Segment event object, where fields and values depend on the event type. For example, in "Identify" events, Segment formats the object to match the [Identify spec](/docs/connections/spec/identify/).
81
+
-**event** - Segment event object, where fields and values depend on the event type. For example, in Identify events, Segment formats the object to match the [Identify spec](/docs/connections/spec/identify/).
84
82
-**settings** - Set of [settings](#create-settings-and-secrets) for this function.
85
83
86
84
The example below shows a function that listens for "Track" events, and sends some details about them to an external service.
@@ -104,16 +102,16 @@ async function onTrack(event) {
104
102
}
105
103
```
106
104
107
-
To change which event type the handler listens to, you can rename it to the name of the message type. For example, if you rename this function `onIdentify`, it listens for "Identify" events instead.
105
+
To change which event type the handler listens to, you can rename it to the name of the message type. For example, if you rename this function `onIdentify`, it listens for Identify events instead.
108
106
109
-
To ensure the Destination processes an event payload modified by the function, return the `event` object at the handler's end.
107
+
To ensure the destination processes an event payload modified by the function, return the `event` object at the handler's end.
110
108
111
109
> info ""
112
110
> Functions' runtime includes a `fetch()` polyfill using a `node-fetch` package. Check out the [node-fetch documentation](https://www.npmjs.com/package/node-fetch){:target="_blank"} for usage examples.
113
111
114
112
### Variable scoping
115
113
116
-
When declaring settings variables, make sure to declare them in the function handler rather than globally in your function. This prevents you leaking the settings values across other function instances.
114
+
When declaring settings variables, make sure to declare them in the function handler rather than globally in your function. This prevents you from leaking the settings values across other function instances.
117
115
118
116
The handler for insert functions is event-specific, for example, `onTrack()`, `onIdentify()`, and so on.
119
117
@@ -208,9 +206,9 @@ You may want to consider the [context object's](/docs/connections/spec/common/#c
208
206
209
207
{% include content/functions/settings.md %}
210
208
211
-
Next, fill out this setting's value in the **Test** tab, so you can run the function and verify that the correct setting value is passed. (This value is only for testing your function.)
209
+
5. Fill out this setting's value in the **Test** tab, so you can run the function and verify that the correct setting value is passed. (This value is only for testing your function.)
212
210
213
-
Now that you've configured a setting and entered a test value, you can add code to read its value and run the function, as in the example below:
211
+
6. Add code to read its value and run the function, as in the example below:
0 commit comments