Functions for Applications
Azion Functions allows you to create event-driven, serverless applications, closer to your users.
With Functions for Applications, you can:
- Implement the required logic.
- Reuse an function in different applications.
- Keep and retrieve your pre-configured environment variables.
- Access databases.
- Write your code in JavaScript.
- Deploy functions easily.
- Make use of pair programming with the Chat GPT integration.
- Preview the outcome of the function live on the preview deployment.
- Run AI agents directly on Azion’s distributed infrastructure with ultra-low latency.
- Build complete AI ecosystems.
Implementation
| Scope | Guide |
|---|---|
| API Builder | How to build an API with Functions and ChatGPT |
| Examples | Examples |
| Code samples | GitHub repository |
Azion Runtime
By using JavaScript in Functions, you can execute code closer to the end user, enhancing performance and enabling custom logic for handling requests and responses.
By using the Azion Runtime to develop your functions, you have a set of tools that help you implement your logic.
Go to azion runtimeGo to supported Web Frameworks
Go to supported Web APIs
Go to node.js support reference
How frameworks integrate with Functions
When you deploy a web framework project on Azion, the platform transforms your framework code into Functions that run on Azion Runtime. This process is handled by the Azion Bundler, an open-source framework adapter built specifically for Azion’s distributed architecture.
Architecture flow
Framework Code (Next.js, Astro, Vue, etc.) ↓ Azion Bundler ↓ Function (JavaScript/Wasm) ↓ Azion Runtime ↓ Global Points of PresenceHow it works
-
Framework detection: When you initialize a project with Azion CLI, the bundler identifies your framework and applies the appropriate adapter.
-
Code transformation: The bundler converts your framework’s server-side logic, API routes, and middleware into Functions compatible with Azion Runtime.
-
Function generation: Each route, API endpoint, or server component becomes a Function that can be executed independently at the edge.
-
Deployment: Functions are distributed across Azion’s global network, executing closer to users without cold starts.
Benefits of framework-to-Function transformation
| Aspect | Traditional hosting | Azion Functions |
|---|---|---|
| Latency | Round-trip to centralized origin | Execution at global points of presence |
| Cold starts | Common in serverless platforms | Eliminated through Azion Runtime architecture |
| Scaling | Manual configuration or delayed auto-scale | Instant scale from zero to peak |
| Framework features | Limited by hosting provider | Full framework capabilities preserved |
Supported frameworks
For the complete list of supported frameworks and detailed compatibility information, see Frameworks compatibility.
Practical implications
When you deploy a framework project, keep in mind:
- Compute costs: Framework deployments generate Functions, which incur compute time and invocation charges. See Pricing for details.
- Debugging: Use Preview Deployment, Data Stream, or GraphQL API to debug framework-generated Functions.
- Environment variables: Access environment variables in your framework code using Azion’s environment variables API.
Explore Azion Bundler on GitHub
AI Framework Support
Functions provides support for advanced AI workflows, enabling you to:
- Run AI agents directly on Azion’s distributed infrastructure with ultra-low latency, building enterprise-grade solutions that operate at the edge with reliability and scale.
- Create sophisticated AI workflows using LangGraph and LangChain integrations, including advanced retrieval capabilities that combine vector and full-text search for complex use cases.
- Leverage native SQL Database integration for RAG implementations and vector storage, along with MCP Servers that enable agent-to-agent collaboration using Google’s Agent2Agent (A2A) protocol.
- Access state-of-the-art models like Mistral, Florence, Qwen, and others, that follow OpenAI’s API standard, all while reducing complexity with a fully integrated AI infrastructure running at the edge of the network.
Azion’s AI Inference allows you to run AI models on Azion Runtime, and can be used together with Functions to create complex AI-powered applications.
Learn more about AI InferenceJavaScript frameworks
Next.js
Next.js is a JavaScript framework built on top of React that enables server-side rendering (SSR) and static site generation for building Jamstack applications.
Jamstack
Jamstack stands for JavaScript, APIs, and Markup, and it promotes decoupling the front end from the back end by pre-rendering content and serving it as static files.
SSR
SSR allows rendering React components on the server before sending them to the client, enhancing initial load times and improving SEO.
Static Site
Static site generation generates static HTML files at build time, which can be cached and delivered quickly to users, reducing the need for server-side processing.
WebAssembly
WebAssembly (Wasm) is a binary instruction format that allows high-performance execution of code on the web. It enables running applications at near-native speed, bridging the gap between different programming languages and platforms.
Azion Functions leverages the power of WebAssembly to provide serverless computing at the edge of the network, enabling developers to deploy custom logic and optimize web applications with reduced latency and improved performance.
This combination of WebAssembly and Azion Functions opens up new possibilities for creating faster, more efficient, and scalable web experiences.
Learn more on How to create an function using WebAssembly on the Azion Web Platform.
Function instantiation
The Functions instances module allows you to instantiate serverless functions in your applications, as well as set up conditions for their execution.
Once your application runs an function, it responds to events closer to the end user, ensuring greater scalability and availability.
Learn more about Functions Instances.
Rules Engine
Rules Engine handles the conditional execution of behaviors through logical operators. By using Rules Engine, you can build an architecture that provides better performance to your users while consuming fewer resources by processing at the origin.
Learn more about Rules Engine.
Code Editor
The code editor for Functions is the best way to get started developing your functions on the Azion’s platform. It’s a web-based code editor that makes it easier and more intuitive to develop your applications. It’s empowered by the Monaco Code Editor, used in VS Code. If you’re used to VS Code, you’ll get familiar with it right away.
Some of its key features are:
- Syntax Highlighting
- Intellisense
- Debugging
Learn more about the Functions Code Editor.
AI Assistant
Generative AI can be used in almost all tasks that involve understanding or generating natural language or code. In the development environment, it’s a tool used for boosting developers’ productivity.
In the functions scenario, it helps developers to:
- Debug code.
- Refactor code.
- Generate code based on prompts.
Learn more about the AI Assistant.
Preview
You can check if the output is the expected with the Preview Deployment, making use of the PreviewProvider function, that emulates a request.
Learn more about Preview Deployment.
Debug
You can debug your functions in real time using the inspect tool inside the Preview Deployment section.
You can also debug using:
Environment variables
Environment variables are a crucial aspect of software development and deployment. They are used to store sensitive information or configuration settings that shouldn’t be hardcoded into the codebase.
Learn more about Environment Variables.
JSON Args
When you add JSON args, you can have different behaviors in your function without having to alter the code. Once you’ve set your JSON args, you can retrieve them by calling event.args("desiredArg").
Functions management
There are different ways to manage your functions on the Azion Web Platform. You can do this through Azion Console, Azion CLI, Azion API, and Terraform.
Azion Console
You can create and manage functions through Azion Console, found on the Products menu below Edge Libraries.
CLI
The Azion CLI allows you to manage your functions for applications through the terminal.
Learn more about Azion CLI functions command and its subcommands
API
The Azion API, accessed through Postman, offers the methods and calls necessary to manage your functions.
Access the Azion API collection and test the requests.
Terraform
The Azion Terraform Provider allows the management of functions on the Azion platform. It makes possible to treat your infrastructure as code.
Learn more about the management of functions trough the Azion Terraform Provider.
Limits
These are the default limits:
| Scope | Limit | Description |
|---|---|---|
| Arguments | 100 KB | Maximum size of the JSON args object passed to a function instance. Exceeding this limit causes the function to fail at instantiation. |
| Memory per Isolate | 512 MB | Maximum memory available to a single function execution context (V8 isolate). This includes heap, stack, and all runtime allocations. |
| Code Limit (UI) | 6 MB | Maximum size of the function source code when created or edited through Azion Console |
| Code Limit (API) | 20 MB | Maximum size of the function source code when deployed via the Azion API. |
| Environment variable size | 32 KB | Maximum total size of all environment variables combined for a single function. |
| Sub-Requests | 50 Sub-Req | Maximum number of outbound fetch() calls a function can make during a single invocation. |
| Max CPU Execution Time | 2s | Maximum CPU time a function can consume per invocation. This measures active computation time, not wall-clock time. Functions exceeding this limit are terminated. |
| Max Execution Time | 5 min | Maximum wall-clock time (total elapsed time) allowed for a function invocation, including I/O wait, fetch() calls, and async operations. |
| Max Cold Start | 2s | Maximum time allowed for a function to initialize before handling its first request. Azion Runtime is designed to minimize cold starts across the global network. |
| URL Size | 16 KB | Maximum size of the request URL that a function can process, including the path and query string. |
| Header Size | 64 KB | Maximum total size of all HTTP request headers combined that a function can read or write. |
| Body Size | 100 MB (Developer plan) 200 MB (Business plan) 500 MB (Enterprise and Mission Critical plans) | Maximum size of the HTTP request or response body that a function can process. Limits vary by service plan. |