Skip to content

Upload code as a ZIP

View as Markdown

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.

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.

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.txt

For a Node.js HTTP runtime:

my-function/
index.mjs
package.json

For 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.

  1. Above the editor, find the upload area “Drag and drop your .zip file here (max 50MB), or click to upload”.
  2. 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:

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.

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.