await site.deploy({ files: "./out" }); // Node: a folder
await site.deploy({ files: [{ path: "index.html", content: html }] }); // anywhere
await app.deploy({ files: "./build", server: "server/index.js" });
await fn.deploy({ code: "export default { async fetch(request) { … } }" });site.deploy(files="./out") # a folder on this machine
site.deploy(files=[{"path": "index.html", "content": html}]) # files you hold in memory
fn.deploy(code="export default { async fetch(request) { return new Response('ok') } }") # an edge modulefilesstring | arrayA folder path (Node), or [{ path, content }]. content takes text or bytes.
serverstringFor an app: the server module inside that folder.
codestringFor a function: the module itself.
Nothing secret ships, and what was dropped is said
| Dropped | Why |
|---|---|
.env and its variants | Credentials, served publicly. |
.git/ | The whole history, including what was removed from it. |
node_modules/ | Enormous, and not what is served. |
The answer lists what was skipped. Somebody who meant to deploy a file named like one of these learns it did not go, rather than wondering later why the page is missing.
An app's server module is not one of its files
An asset is served publicly, so leaving the server module among them would publish the application's source on its own site. It ships as the module instead — and no wrapper is needed, since assets are served first and the module only gets what they do not cover.
The bounds, imposed before anything is sent
| Thing | Bound |
|---|---|
| Files per deploy | 20 000 |
| One file | 25 MB |
| A function's code | 10 MB |
Checked here rather than discovered at the far end, so a deploy that cannot work fails before the bytes travel.
A deploy replaces the set
It is not additive: a file that was online and is not in this deploy is gone. That is also why a rollback is a complete return rather than a patch.
A path cannot leave the root
Normalised, and refused if it climbs out. A file cannot be served from somewhere other than where it was put.
A site needs an index
A site with no entry page is refused: it would answer nothing at its own address.
Errors
| Code | Status | When |
|---|---|---|
| nothing_to_deploy | 400 | No files, no code, or a file with no path. |
| deploy_too_large | 413 | Past one of the bounds. The message names the file. |
| quota_exceeded | 403 | The account's object storage is full. |
| hosting_kind_unavailable | 501 | That kind cannot serve. |