Functions
Functions let you process sensitive data by adding custom logic to your workflows. With functions, you can develop custom code using Node.js to perform tasks like data transformation, file creation, or validation. Once you upload your custom code, you can deploy this code to your environment and invoke the deployment using a connection.
Concepts
Functions are made of environment variables, tags, deployments, and handlers. After you upload your function, you can choose which environments you want to deploy it in. You can deploy functions with code content as a field in a JSON payload or zipped code as a request payload.
Environments and environment variables
Function environments reside at the account level and are where you deploy your functions. Each environment can have many environment variables, such as variables that store credentials your function uses to communicate with your vault and downstream services. Accounts automatically come with one default environment. You can call Function APIs to create more account-level environments or to mark a different environment as the default.
All environment variables for a function can’t be greater than 4 KB. If the total size of your variables is greater than 4 KB, compress the data before setting the variables, and decompress the data inside the function.
Functions and function tags
For every function you create and upload to your account, Skyflow assigns an ID. Additionally, because you can develop multiple versions of custom code for each function, your code version also has a tag. Therefore, each time you update a function with new code, you receive a new tag as a response that identifies the version of the function.
Methods
When you upload your function code, you must declare a handler which is a module within your function. In addition to the handler, you need to determine a method. A method is a pointer to invoke the functionality that the handler defines. Each function can have one or more handlers with corresponding methods.
Deployment
When you run a connection, the connection can invoke a function deployment. To create a function deployment, you specify a function ID, function tag, region ID, and environment name. Unless you specify an environment, the function deploys to the default environment. When configuring a connection to invoke a function deployment, you need the function’s deployment ID and method name.
Use cases
Functions let you handle sensitive data by providing a secure and compliant environment to run your custom code. You can use functions to
- Transform incoming data into a standardized format that your backend systems can efficiently process.
- Use sensitive data stored in vaults to generate mission-critical reports for downstream services.
- Send an identifier to a connection and upload a file stored in the vault to a document cloud service, like DocuSign.
Next steps
Functions let you use domain-specific knowledge and expertise to tailor your solutions to unique data processing challenges. Review some sample functions or create a function to get started.