Home /  Legacy products / 
This is a legacy product

Functions Classic

Version Note: This page covers the Functions Classic product; for the current generation of Functions please visit the latest version of the Functions documentation.
Functions is a compute service that lets you run code without provisioning or managing servers. With Functions, Stedi runs your code on high-availability compute infrastructure that automatically scales up and down according to your usage. You can run code for virtually any type of integration or other standalone backend service – all you need to do is supply your source code.

Stedi runs your function only when needed and scales automatically, from a few requests per day to up to 50 concurrently by default. You pay only for the compute time that you consume — there is no charge to create functions, and there is no charge when your code isn't running.

How can Functions be used?

You can invoke functions using the Functions Software Developer Kit (SDK). Another way that functions can run is in response to activity within a Stedi Bucket. Here are a few ideas about what you could build:
  • automatically process EDI files received via SFTP by sending them to the EDI Translate API.
  • send translated payloads to external API endpoints.
  • call the EDI Translate API to translate EDI to JSON, and then transform the output using the Mappings API.
  • or do something completely unrelated to your other Stedi workflows!

Features

Here’s what you can do with Functions.

You can create, update, and invoke functions with the Functions API or through the web UI. The API is more flexible and gives you access to create/update functions using a zip archive. You can follow the deployment tutorial to learn more about that. The web UI gets you up and running quickly, but it doesn’t support third-party libraries and it makes it hard to keep your code in a version control system. We recommend you use the web UI to experiment with Functions, and the API for production-level usage.

A real-world example

Let's say that you receive EDI 850 purchase orders from your trading partner. The trading partner delivers these files to you via Stedi SFTP and you need to transform it somehow into an XML document for your ERP.

Using Stedi Functions, you can convert the EDI file to JSON. Next, you can transform the JSON into the desired JSON schema and convert the document to XML. Finally, the XML document is posted to an external webhook of the ERP.

You could use variations of this pattern to convert documents between other file formats and extend the function further with additional features.

You can find instructions for how to deploy your first Stedi Function in the GitHub repo. We would also encourage you to take a look at the other Stedi Demos.

Supported languages

  • JavaScript (or any other language that compiles to JavaScript, like TypeScript).

Choosing a module system

Version Note: You can only choose a module system for the functions labeled New (v2) in the Functions UI.

Functions support both CommonJS (CJS) and ECMAScript (ESM) modules. Stedi infers the module system from the file extension: .js for CJS and .mjs for ESM.

You cannot change the module system if your function package contains multiple files (usually the case if it's been bundled). Changing a function module system impacts how the function behaves, so ensure the function's code is compatible with the selected module system before updating it.

To edit the module system for a function, go to that function in the UI, click Edit, and then select a module system from the menu at the top of the editor.
Please contact us to request support for addtional languages.

Limitations

There are some restrictions you should keep in mind.

  • The name of a function can be up to 64 characters long and can only contain characters that are valid in a URL.
  • The maximum execution time of a function is 15 minutes. Your function is deployed with a 3-second timeout by default, which you can increase using the API.
  • Functions that require packages and other assets can only be deployed as a single zip archive. The overall size of the zip file is limited to 3.25 MB, and zip files can only be uploaded via API. Our web UI only supports self-contained code consisting of a single source code file.
  • When a function has not run for a while, or when a large burst of requests arrives, the initial invocation(s) of a function may take a few seconds longer than normal. After such a "cold start" the function will be "warm" and its latency will settle down to just the execution time of your own code.

API documentation

For detailed descriptions please refer to the API reference.
How can Functions be used?FeaturesA real-world exampleSupported languagesLimitationsAPI documentation

Feedback

Have an idea for something we could improve? Page not clear? We love feedback - send us a message.

Stedi

Build EDI integrations fast, without being an EDI expert

Start building
About
ProductPricingCareersContactBlog
Follow
  1. Twitter
  2. GitHub
Backed by
AdditionBloomberg BetaFirst RoundStripeUSV
Customer AgreementService TermsPrivacy Notice

Stedi is a registered trademark of Stedi, Inc. All names, logos, and brands of third parties listed on our site are trademarks of their respective owners (including “X12”, which is a trademark of X12 Incorporated). Stedi, Inc. and its products and services are not endorsed by, sponsored by, or affiliated with these third parties. Our use of these names, logos, and brands is for identification purposes only, and does not imply any such endorsement, sponsorship, or affiliation.