From 843fdca43ed03955b4564cc09678961cb68cdbf6 Mon Sep 17 00:00:00 2001 From: Sharon Adewusi Date: Fri, 21 Mar 2025 14:25:10 +0000 Subject: [PATCH 1/2] Update source functions - include variable scoping [DOC-1065].md --- src/connections/functions/source-functions.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/connections/functions/source-functions.md b/src/connections/functions/source-functions.md index 43ca32fc88..b73db32924 100644 --- a/src/connections/functions/source-functions.md +++ b/src/connections/functions/source-functions.md @@ -261,6 +261,12 @@ The `Segment.set()` method accepts an object with the following fields: > warning "" > When you use the `set()` method, you won't see events in the Source Debugger. Segment only sends events to connected warehouses. +### Variable scoping + +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. + +The handler for Source functions is `onRequest()`. + ### Runtime and dependencies {% include content/functions/runtime.md %} From 552e45b6bb87f8e9a43ecb206fbde64da2378795 Mon Sep 17 00:00:00 2001 From: Sharon Adewusi Date: Fri, 28 Mar 2025 11:26:52 +0000 Subject: [PATCH 2/2] Update src/connections/functions/source-functions.md Co-authored-by: stayseesong <83784848+stayseesong@users.noreply.github.com> --- src/connections/functions/source-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connections/functions/source-functions.md b/src/connections/functions/source-functions.md index b73db32924..86bc3ccf36 100644 --- a/src/connections/functions/source-functions.md +++ b/src/connections/functions/source-functions.md @@ -263,7 +263,7 @@ The `Segment.set()` method accepts an object with the following fields: ### Variable scoping -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. +Declare settings variables in the function handler, rather than globally in your function. This prevents you from leaking the settings values across other function instances. The handler for Source functions is `onRequest()`.