> For the complete documentation index, see [llms.txt](https://docs.acecloud.ai/knowledge-base/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.acecloud.ai/knowledge-base/functions/how-to-develop-and-deploy-a-function.md).

# How to Develop and Deploy a Function?

After creating a function, you can develop its source code directly in the AceCloud portal or upload the function source as an archive. AceCloud Functions supports **Python, Node.js, and Go** runtimes. The function source must contain a valid handler that matches the selected runtime.

### **Before you begin**

Make sure that:

* You have already created a function in AceCloud Functions.
* You know the runtime selected for the function.
* Your function contains a valid handler.
* If you are uploading an archive, the archive follows the required directory structure and contains the required dependency file.

### **Develop a Function**

You can develop your function in either of the following ways:

* **Write in browser** — Write and edit the function source directly in the AceCloud portal.
* **Upload archive** — Upload a .zip or .tar.gz archive containing your function source.

Open the required function from **Functions > Overview**, and then select the **Editor** tab.

### **Option 1: Write the Function in the Browser**

The **Write in browser** option provides an editor where you can create and modify your function source.

The editor contains the function files and folders on the left and the source code editor on the right.

#### What the Editor shows after creation

After opening a created function and selecting Editor, the Write in browser view shows the function's files and folders on the left and the selected source file in the code editor on the right. The shown controls include Save Draft and Apply new version.

Dependency file editability: the current screenshots do not confirm whether requirements.txt, package.json, or go.mod can be created or edited directly in the browser. If a dependency file appears in the Editor file tree, select it to check whether it is editable. If it is not available there, update the dependency file locally and upload the updated archive.

#### **Create the function handler**

Your function must contain a handler that matches the selected runtime.

| **Runtime** | **Handler file**      | **Handler** |
| ----------- | --------------------- | ----------- |
| Python      | functions/function.py | handler     |
| Node.js     | functions/function.js | handler     |
| Go          | functions/function.go | Handler     |

For example, a Python function can use:

def handler(event: dict, context) -> dict:\
return {\
"message": "Hello, World!"\
}

For Node.js:

export async function handler(event, context) {\
return {\
message: "Hello, World!"\
};\
}

For Go:

package functions

import "acefaas/faas"

func Handler(event map\[string]any, ctx \*faas.Context) (any, error) {\
return map\[string]any{\
"message": "Hello, World!",\
}, nil\
}

The handler name is important. Python and Node.js functions require a handler named handler, while Go requires an exported Handler function in the functions package.

### Event and response reference

The event argument contains request or invocation data supplied to the handler. Available fields depend on the invocation and runtime, so inspect the event received by your function when you need to confirm the exact shape.

• For HTTP-style requests, useful fields may include method, path, query parameters, headers, and request body when provided by the runtime.

• A bare response can return a value such as {"message": "Hello, World!"}. An explicit HTTP-style response can include fields such as statusCode, headers, and body. Use the response format expected by the selected runtime and invocation type; do not assume every function requires statusCode/body.

#### **Save your changes**

After editing the source code, click **Save Draft**.

Saving the draft stores your changes without creating a new deployed version.

Review the source code and make any required changes before applying it as a new version.

#### **Apply the function as a new version**

After the source code is ready, click **Apply new version**.

AceCloud builds the function source and creates a new function version. If the source does not satisfy the required handler or package structure, deployment is rejected before a new version is created.

## **Option 2: Upload a Function Archive**

If you develop your function locally, you can package the source code and upload it to AceCloud Functions.

In the **Editor** tab, select **Upload archive**.

The upload interface accepts:

* .zip
* .tar.gz

The archive size must not exceed **50 MB**.

#### **Prepare the archive**

Place the function source inside a functions/ directory at the root of the archive.

The dependency file must be placed at the archive root.

The general structure is:

function-archive/\
├── functions/\
│ └── function.\
└──

The dependency file depends on the selected runtime:

| **Runtime** | **Dependency file** |
| ----------- | ------------------- |
| Python      | requirements.txt    |
| Node.js     | package.json        |
| Go          | go.mod              |

The runtime also requires the appropriate handler structure inside the functions/ directory.

#### **Python archive**

A Python function can use:

functions/\
└── function.py

requirements.txt

If your function does not use third-party packages, requirements.txt can be empty.

#### **Node.js archive**

A Node.js function can use:

functions/\
└── function.js

package.json

The package.json file must specify ES modules:

{\
"name": "hello-world",\
"type": "module"\
}

The "type": "module" setting is required for Node.js functions.

#### **Go archive**

A Go function can use:

functions/\
└── function.go

go.mod

The go.mod file must declare the acefaas module:

Use a Go directive compatible with the runtime version selected for the function. For example, do not use go 1.26 automatically if Go 1.25 is selected; the directive must fit the selected runtime.

module acefaas

go 1.26

The handler file must use the functions package and define a top-level Handler function.

### **Upload the Archive**

1. Open the required function.
2. Select **Editor**.
3. Select **Upload archive**.
4. Click **Choose archive**.
5. Select the .zip or .tar.gz file.
6. Review the validation checklist.
7. Click **Upload as draft**.

AceCloud validates the archive before saving it as a draft.

The archive must satisfy the required structure, including the functions/ directory, the runtime-specific dependency file, and the required handler. The archive must also be within the **50 MB** size limit.

**Note:** For Go functions, the handler must be a top-level Handler function in the functions package. The Go deployment policy also prevents code under functions/ from importing the unsafe package.

## **Manage Function Dependencies**

If your function uses external packages, declare them in the dependency file for the selected runtime.

#### **Python**

Add packages to requirements.txt.

Example:

requests==2.32.5

#### **Node.js**

Add packages to package.json.

Example:

{\
"type": "module",\
"dependencies": {\
"axios": "^1.12.2"\
}\
}

#### **Go**

Declare Go modules in go.mod.

For functions with external Go dependencies, keep go.mod and go.sum synchronized. You can run:

go mod tidy

For a reproducible build, you can vendor the dependencies:

go mod tidy\
go mod vendor

When using vendor/, keep vendor/modules.txt synchronized with go.mod and go.sum.

## **Deploy a New Version**

After you have finished developing or uploading the source:

1. Open the **Editor** tab.
2. Review the current draft.
3. Click **Apply new version**.
4. Wait for the deployment to complete.
5. Open the **Overview** tab to verify the applied version.

The function's **Overview** page displays information such as the runtime, applied versions, latest version, endpoint, scaling configuration, CPU, RAM, ephemeral storage, timeout, and log retention.

Each successful deployment creates a new function version, allowing you to manage changes independently from the existing version.

### Check deployment status and errors

After clicking Apply new version, wait for the build and deployment to finish and review the status shown in the portal. If it fails, open the related validation, build, or deployment details and read the reported error before retrying. The supplied screenshots do not show a failed deployment, so exact labels and common error strings must be confirmed in the live portal before being documented as exact UI text.

• For archive or validation failures, check the validation checklist and build output for issues such as an incorrect archive layout, a missing runtime dependency file, or an invalid handler.

• For build or runtime configuration failures, check the error output for dependency, package/module, or Go runtime-version issues. Go deployment policy may also reject imports of the unsafe package under functions/.

• For deployment failures, inspect the deployment status/details and the Versions tab for the attempted version's status, if shown. Do not rely on function execution Logs alone when a version has not deployed.

### Call the deployed function

The function's Overview page displays the endpoint. Copy the endpoint shown there to call the deployed function. Authentication requirements depend on the endpoint configuration; check the function's authentication settings and supply the required credentials or headers.

Example curl request (replace the placeholder endpoint and adapt authentication to your configuration):

curl -i -X GET "[https://YOUR%5FFUNCTION%5FENDPOINT/](https://your_function_endpoint/)"

-H "Authorization: Bearer YOUR\_TOKEN"

The Authorization header above is only an example for a bearer-token endpoint. If your endpoint uses a different authentication method or does not require authentication, adjust the request accordingly.

### Manage function versions and rollback

Open the Versions tab to review available function versions. Applying a new version creates a new version, but the source material supplied for this KB does not establish which version automatically receives traffic after a new version is applied. After deployment, verify the active/latest version and traffic behavior in the Overview or Versions interface.

Rollback: if the Versions tab provides an action to restore or activate an earlier version, select the intended known-good version and follow the portal's confirmation flow. The exact rollback control and traffic-switching behavior are not shown in the supplied screenshots, so verify these in the live portal before publishing click-by-click instructions.

## **Next Steps**

After saving your draft or applying a version, you can:

* Test the saved draft from the Test tab before applying it as a new version.
* View the deployed version from **Versions**.
* Review execution metrics in **Insights**.
* Troubleshoot function execution using **Logs**.
