3 ms·
Segment Functions - Build custom data integrations in a few lines of JavaScript
- nzoschke 7y agoEngineer on the Segment Functions product here. Happy to discuss any questions about how it works and how we built it.
- ryanworl 7y agoAre you using AWS Lambda to provide the sandboxing? If so: How does the user code actually end up running on the Lambda? Do you have a generic wrapper Lambda which `eval`s the user code, or do you deploy an individual Lambda for each function, etc?
- nzoschke 7y agoYes we are using Lambda under the hood. Every customer's custom source or destination is its own Lambda function. This gives us a ton of fine-grained isolation, scalability and visibility out of the box. We ask customers to implement a single function that converts an incoming webhook to Segment data points: async function onRequest(request, settings) { Segment.track(...) } Inside the function we save the users code to `handler.js` and inject index.js that loads and calls the users `onRequest` function.