Skip to content

Commit cbdf4ab

Browse files
Enhance documentation on Node.js API compatibility and polyfills, adding status legends and deployment instructions for Azion functions. (#2272)
1 parent c2e0b5a commit cbdf4ab

4 files changed

Lines changed: 104 additions & 8 deletions

File tree

src/content/docs/en/pages/devtools/azion-edge-runtime/compatibility/node-polyfills/cells-node.mdx

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,25 @@ The Azion Runtime provides native support for the File System (FS) module, allow
6060

6161
A polyfill is a code snippet, often used in JavaScript, that brings new features to environments lacking these capabilities. Polyfills are used during build time at Azion and can be configured through the [azion.config.js](/en/documentation/devtools/cli/configs/azion-config-js/) file.
6262

63-
The following Node APIs are supported through polyfills, along with their respective supported methods.
63+
The following Node APIs are supported through polyfills, along with their respective supported methods.
64+
65+
**Status legend:**
66+
67+
- 🟢 **Supported**: the API works normally at runtime.
68+
- 🟡 **Partially supported**: only some methods or features are available.
69+
- 🔴 **Build-only**: the module is included so the build process completes without errors, but API calls do not work at runtime.
70+
71+
:::note[About the Azion Cells runtime environment]
72+
Functions on Azion run inside **Cells**, an isolation environment based on **V8 Isolates**. Each Cell is a lightweight, secure execution context with no direct access to the underlying operating system.
73+
74+
For multi-tenant security and infrastructure integrity reasons, Cells do not allow:
75+
76+
- Access to operating system properties (such as hostname, platform, or CPU/memory information via `node:os`).
77+
- DNS resolution via native system calls (`node:dns`, `node:dns/promises`).
78+
- Creation of low-level TCP/UDP sockets that require direct syscalls.
79+
80+
Modules marked as 🔴 **Build-only** are included as stubs to ensure that NPM packages with static dependencies on these modules can be compiled. Calls to these modules at runtime produce no results and may return default values or throw silent errors.
81+
:::
6482

6583
| Module | Status |
6684
|-----------------------|--------|
@@ -89,8 +107,8 @@ The following Node APIs are supported through polyfills, along with their respec
89107
| [crypto](/en/documentation/products/azion-edge-runtime/compatibility/node/crypto/) | 🟡 Partially supported |
90108
| dgram | 🟢 Supported |
91109
| diagnostics_channel | 🟢 Supported |
92-
| dns | 🟢 Supported |
93-
| dns/promises | 🟢 Supported |
110+
| dns | 🔴 Build-only |
111+
| dns/promises | 🔴 Build-only |
94112
| domain | 🟢 Supported |
95113
| [events](/en/documentation/products/azion-edge-runtime/compatibility/node/events/) | 🟢 Supported |
96114
| [fs](/en/documentation/products/azion-edge-runtime/compatibility/node/fs/) | 🟡 Partially supported |
@@ -102,7 +120,7 @@ The following Node APIs are supported through polyfills, along with their respec
102120
| inspector/promises | 🟡 Partially supported |
103121
| [module](/en/documentation/products/azion-edge-runtime/compatibility/node/module/) | 🟡 Partially supported |
104122
| net | 🟡 Partially supported |
105-
| [os](/en/documentation/products/azion-edge-runtime/compatibility/node/os/) | 🟢 Supported |
123+
| [os](/en/documentation/products/azion-edge-runtime/compatibility/node/os/) | 🔴 Build-only |
106124
| [path](/en/documentation/products/azion-edge-runtime/compatibility/node/path/) | 🟢 Supported |
107125
| path/posix | 🟡 Partially supported |
108126
| path/win32 | 🟡 Partially supported |

src/content/docs/en/pages/devtools/azion-edge-runtime/compatibility/use-polyfills.mdx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,34 @@ Now you can check the logs in the terminal and see the Buffer API working throug
185185
You can access a list of APIs resolved through polyfills by Azion Bundler build on [its repository](https://github.com/aziontech/bundler) and on [Azion's compatibility documentation](/en/documentation/products/azion-edge-runtime/compatibility/node/). Azion Bundler's an **open-source** project and you can propose new presets and implementations.
186186
:::
187187

188+
---
188189

190+
## Deploy the function to Azion
189191

190-
---
192+
After testing locally with `azion dev`, deploy your function to the Azion Platform:
193+
194+
13. Run the deploy command:
195+
196+
```bash
197+
azion deploy
198+
```
199+
200+
The CLI builds the project, applies the configured polyfills, and publishes the function to the platform. At the end of the process, you'll receive the URL to access your application.
201+
202+
### Useful deploy flags
203+
204+
| Flag | Description |
205+
|------|-------------|
206+
| `--auto` | Runs the complete build, provisioning, and distribution flow without interruptions or interactive prompts. |
207+
| `--workers <number>` | Sets the number of parallel workers for uploading static files to Object Storage. By default, it's automatically calculated based on available CPU cores (maximum: 20). |
208+
| `--dry-run` | Simulates the deploy process locally, validating the generated routing rules without affecting production resources. |
209+
210+
**Example with flags:**
211+
212+
```bash
213+
azion deploy --auto --workers 10
214+
```
215+
216+
:::note
217+
The build process applies polyfills automatically based on the `azion.config.js` file configuration. Make sure the required modules are listed in the `polyfills` property before deploying.
218+
:::

src/content/docs/pt-br/pages/devtools/azion-edge-runtime/compatibilidade/node-polyfills/node.mdx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,24 @@ Um polyfill é um trecho de código, frequentemente usado em JavaScript, que tra
6363

6464
A tabela abaixo contém a compatibilidade dos módulos Node.Js resolvidos com polyfills.
6565

66+
**Legenda de status:**
67+
68+
- 🟢 **Suportada**: a API funciona normalmente em tempo de execução.
69+
- 🟡 **Parcialmente suportada**: apenas alguns métodos ou funcionalidades estão disponíveis.
70+
- 🔴 **Somente para build**: o módulo é incluído para que o processo de build seja concluído sem erros, mas as chamadas à API não funcionam em tempo de execução.
71+
72+
:::note[Sobre o ambiente de execução Azion Cells]
73+
As functions na Azion são executadas dentro de **Cells**, um ambiente de isolamento baseado em **V8 Isolates**. Cada Cell é um contexto de execução leve e seguro, sem acesso direto ao sistema operacional subjacente.
74+
75+
Por razões de segurança multilocatário e integridade da infraestrutura, as Cells não permitem:
76+
77+
- Acesso a propriedades do sistema operacional (como hostname, plataforma ou informações de CPU/memória via `node:os`).
78+
- Resolução de DNS via chamadas de sistema nativas (`node:dns`, `node:dns/promises`).
79+
- Criação de sockets TCP/UDP de baixo nível que exijam syscalls diretas.
80+
81+
Módulos marcados como 🔴 **Somente para build** são incluídos como stubs para garantir que pacotes NPM com dependências estáticas nesses módulos possam ser compilados. As chamadas a esses módulos em runtime não produzem resultados e podem retornar valores padrão ou lançar erros silenciosos.
82+
:::
83+
6684
| Module | Status |
6785
|-----------------------|--------|
6886
| _http_agent | 🟡 Parcialmente suportada |
@@ -90,8 +108,8 @@ A tabela abaixo contém a compatibilidade dos módulos Node.Js resolvidos com po
90108
| [crypto](/pt-br/documentacao/produtos/devtools/azion-edge-runtime/compatibilidade/node/crypto/) | 🟡 Parcialmente suportada |
91109
| dgram | 🟢 Suportada |
92110
| diagnostics_channel | 🟢 Suportada |
93-
| dns | 🟢 Suportada |
94-
| dns/promises | 🟢 Suportada |
111+
| dns | 🔴 Somente para build |
112+
| dns/promises | 🔴 Somente para build |
95113
| domain | 🟢 Suportada |
96114
| [events](/pt-br/documentacao/produtos/devtools/azion-edge-runtime/compatibilidade/node/events/) | 🟢 Suportada |
97115
| [fs](/pt-br/documentacao/produtos/devtools/azion-edge-runtime/compatibilidade/node/fs/) | 🟡 Parcialmente suportada |
@@ -103,7 +121,7 @@ A tabela abaixo contém a compatibilidade dos módulos Node.Js resolvidos com po
103121
| inspector/promises | 🟡 Parcialmente suportada |
104122
| [module](/pt-br/documentacao/produtos/devtools/azion-edge-runtime/compatibilidade/node/module/) | 🟡 Parcialmente suportada |
105123
| net | 🟡 Parcialmente suportada |
106-
| [os](/pt-br/documentacao/produtos/devtools/azion-edge-runtime/compatibilidade/node/os/) | 🟢 Suportada |
124+
| [os](/pt-br/documentacao/produtos/devtools/azion-edge-runtime/compatibilidade/node/os/) | 🔴 Somente para build |
107125
| [path](/pt-br/documentacao/produtos/devtools/azion-edge-runtime/compatibilidade/node/path/) | 🟢 Suportada |
108126
| path/posix | 🟡 Parcialmente suportada |
109127
| path/win32 | 🟡 Parcialmente suportada |

src/content/docs/pt-br/pages/devtools/azion-edge-runtime/compatibilidade/use-polyfills.mdx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,35 @@ Agora você pode verificar os logs no terminal e ver a API Buffer funcionando at
184184
:::tip
185185
Você pode acessar uma lista de APIs que são resolvidas através de polyfills no [repósitório do Azion Bundler](https://github.com/aziontech/bundler) e na [documentacão de compatibilidade da Azion](/pt-br/documentacao/produtos/devtools/azion-edge-runtime/compatibilidade/node/). Azion Bundler é um projeto **open-source** e você pode propor novos presets e implementações.
186186
:::
187+
188+
---
189+
190+
## Fazer o deploy da function na Azion
191+
192+
Após testar localmente com `azion dev`, faça o deploy da sua function para a Azion Platform:
193+
194+
13. Execute o comando de deploy:
195+
196+
```bash
197+
azion deploy
198+
```
199+
200+
O CLI realiza o build do projeto, aplica os polyfills configurados e publica a function na plataforma. Ao final do processo, você receberá a URL de acesso à sua aplicação.
201+
202+
### Opções úteis do comando deploy
203+
204+
| Flag | Descrição |
205+
|------|-----------|
206+
| `--auto` | Executa o fluxo completo de build, provisionamento e distribuição sem interrupções ou prompts interativos. |
207+
| `--workers <número>` | Define o número de workers paralelos para upload de arquivos estáticos para o Object Storage. Por padrão, é calculado automaticamente com base nos núcleos de CPU disponíveis (máximo: 20). |
208+
| `--dry-run` | Simula o processo de deploy localmente, validando as regras de roteamento geradas sem afetar recursos em produção. |
209+
210+
**Exemplo com flags:**
211+
212+
```bash
213+
azion deploy --auto --workers 10
214+
```
215+
216+
:::note
217+
O processo de build aplica os polyfills automaticamente com base na configuração do arquivo `azion.config.js`. Certifique-se de que os módulos necessários estão listados na propriedade `polyfills` antes de fazer o deploy.
218+
:::

0 commit comments

Comments
 (0)