To create a function, you must create a deployment package which includes your code and all dependencies. You can create a deployment package locally or edit code on the FunctionGraph console. If you edit code inline, FunctionGraph automatically creates and uploads a deployment package for your function. FunctionGraph allows you to edit function code in the same way as managing a project. You can create and edit files and folders. After you upload a ZIP code package, you can view and edit the code on the console.
Table 1 lists the code entry modes supported by FunctionGraph for each runtime.
Runtime |
Editing Code Inline |
Uploading a ZIP File |
Uploading a JAR File |
Uploading a ZIP File from OBS |
---|---|---|---|---|
Supported |
Supported |
Not supported |
Supported |
|
Supported |
Supported |
Not supported |
Supported |
|
Not supported |
Supported |
Supported |
Supported |
|
Not supported |
Supported |
Not supported |
Supported |
|
Supported |
Supported |
Not supported |
Supported |
If the code to be uploaded contains sensitive information (such as account passwords), encrypt the sensitive information to prevent leakage.
Code Entry Mode |
Description |
---|---|
Edit code inline |
FunctionGraph allows you to edit function code in the same way as managing a project. You can create and edit files and folders. After you upload a ZIP code package, you can edit the code on the Code tab of the function details page.
|
Upload ZIP file |
|
Upload file from OBS |
|
Editing Code Inline
FunctionGraph provides an SDK for editing code in Node.js. If your custom code uses only the SDK library, you can edit code using the inline editor on the FunctionGraph console. After you edit code inline and upload it to FunctionGraph, the console compresses your code and the related configurations into a deployment package that FunctionGraph can run.
Uploading a Deployment Package
If your code uses other resources, such as a graphic library for image processing, first create a deployment package, and then upload the package to the FunctionGraph console. You can upload a Node.js deployment package in two ways.
After creating a ZIP deployment package, upload it to the FunctionGraph console. If the package size exceeds 40 MB, upload the package from OBS.
For details about function resource restrictions, see section "Notes and Constraints".
After creating a ZIP deployment package, upload it to an OBS bucket in the same region as your FunctionGraph, and then paste the link URL of the OBS bucket into the function. The maximum size of the ZIP file that can be uploaded to OBS is 300 MB.
For details about function resource restrictions, see section "Notes and Constraints".
Editing Code Inline
FunctionGraph provides an SDK for editing code in Python. If your custom code uses only the SDK library, you can edit code using the inline editor on the FunctionGraph console. After you edit code inline and upload it to FunctionGraph, the console compresses your code and the related configurations into a deployment package that FunctionGraph can run.
Uploading a Deployment Package
If your code uses other resources, such as a graphic library for image processing, first create a deployment package, and then upload the package to the FunctionGraph console. You can upload a Python deployment package in two ways.
After creating a ZIP deployment package, upload it to the FunctionGraph console. If the package size exceeds 40 MB, upload the package from OBS.
For details about function resource restrictions, see section "Notes and Constraints".
After creating a ZIP deployment package, upload it to an OBS bucket in the same region as your FunctionGraph, and then paste the link URL of the OBS bucket into the function. The maximum size of the ZIP file that can be uploaded to OBS is 300 MB.
For details about function resource restrictions, see section "Notes and Constraints".
Java is a compiled language, which does not support editing code inline. You can only upload a local deployment package, which can be a ZIP or JAR file.
Uploading a JAR File
Uploading a ZIP File
If your function uses third-party dependencies, compress the dependencies and the function JAR file into a ZIP file, and then upload the ZIP file.
You can upload a Java deployment package in two ways.
After creating a ZIP deployment package, upload it to the FunctionGraph console. If the package size exceeds 40 MB, upload the package from OBS.
For details about function resource restrictions, see section "Notes and Constraints".
After creating a ZIP deployment package, upload it to an OBS bucket in the same region as your FunctionGraph, and then paste the link URL of the OBS bucket into the function. The maximum size of the ZIP file that can be uploaded to OBS is 300 MB.
For details about function resource restrictions, see section "Notes and Constraints".
Uploading a Deployment Package
You can only upload a Go deployment package in ZIP format. There are two ways to upload it.
After creating a ZIP deployment package, upload it to the FunctionGraph console. If the package size exceeds 40 MB, upload the package from OBS.
For details about function resource restrictions, see section "Notes and Constraints".
After creating a ZIP deployment package, upload it to an OBS bucket in the same region as your FunctionGraph, and then paste the link URL of the OBS bucket into the function. The maximum size of the ZIP file that can be uploaded to OBS is 300 MB.
For details about function resource restrictions, see section "Notes and Constraints".
Editing Code Inline
After you edit code inline and upload it to FunctionGraph, the console compresses your code and the related configurations into a deployment package that FunctionGraph can run.
Uploading a Deployment Package
If your code uses other resources, such as a graphic library for image processing, first create a deployment package, and then upload the package to the FunctionGraph console. You can upload a deployment package for a custom runtime in two ways.
After creating a ZIP deployment package, upload it to the FunctionGraph console. If the package size exceeds 40 MB, upload the package from OBS.
For details about function resource restrictions, see section "Notes and Constraints".
After creating a ZIP deployment package, upload it to an OBS bucket in the same region as your FunctionGraph, and then paste the link URL of the OBS bucket into the function. The maximum size of the ZIP file that can be uploaded to OBS is 300 MB.
For details about function resource restrictions, see section "Notes and Constraints".