Instead of typing code in the editor, you can create a function from a ZIP of your code. Use a ZIP for a larger project, or for code you already have on your own machine. Every runtime takes a ZIP, Custom Container Image included.
Before you begin
Section titled “Before you begin”Open Create Function and choose the hardware and runtime, as in Create a function.
To see the layout your runtime needs, download its sample from ZIP File Guidelines & Template
Download. The sample is named after the runtime, such as python-3.11-http.zip. The section
also lists the ZIP rules.
Prepare the ZIP
Section titled “Prepare the ZIP”Put everything in one root directory inside the ZIP, and give the runtime’s required files their exact names. The root directory can have any name, and it can hold other files too. For a Python HTTP runtime, the ZIP looks like this:
my-function/ func.py requirements.txtFor a Node.js HTTP runtime:
my-function/ index.mjs package.jsonFor the files each runtime needs, see Runtimes and hardware.
A ZIP can be up to 50 MB compressed and 200 MB extracted.
Leave out executable and archive files: .exe, .dll, .sh, .bat, .pyc, .class, .jar, and
.zip. A ZIP that contains any of them is refused.
Upload the ZIP
Section titled “Upload the ZIP”- Above the editor, find the upload area “Drag and drop your .zip file here (max 50MB), or click to upload”.
- Drop your ZIP on it, or click it and choose the file.
MyAccount checks the ZIP. If it passes, its files open in the editor, one tab per file. If the check finds a problem, MyAccount shows one of these messages instead:
- “The uploaded ZIP file is too large. Maximum allowed size is 50MB.” See The uploaded ZIP file is too large.
- “File must be a ZIP archive” or “File is not a valid ZIP archive”. See File must be a ZIP archive.
- “Invalid ZIP structure. Expected single root directory”. See Invalid ZIP structure.
- “Missing required files in root: {files}”, with the missing files in place of
{files}. See Missing required files in root.
Create the function
Section titled “Create the function”Fill in the rest of the form as in Create a function, and click Create.
A ZIP whose files sit at the top, in no root directory, passes the upload check. It is refused when you click Create, with “Your function code does not adhere to the E2E Function format as suggested, please review your code.” The rejected function still appears in the list as Failed.
Put the files in one root directory, zip that directory, and create the function again. To reuse the name, delete the failed function first. See Function with name {name} already exists.
Check that the function is running
Section titled “Check that the function is running”The function moves through Creating and Deploying, then reads Running once the ZIP has deployed.
If the function reads Failed after a build, open its page and read the Build Logs tab. See Troubleshooting Functions.
You now have a function built from your ZIP. To change the code later, edit it in the editor or upload a fresh ZIP on the function’s page. See Edit a function.