Skip to content

Commit

Permalink
[EDU-2609] feat: cells node compatibility (#451)
Browse files Browse the repository at this point in the history
* add compatibility cells-node page

* adjustments

* remove duplicate

* cells-node compatibility

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

Co-authored-by: hannah <[email protected]>

* Update src/i18n/en/runtimeMenu.ts

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

Co-authored-by: Mariana Bellorín Aguilera <[email protected]>

---------

Co-authored-by: hannah <[email protected]>
Co-authored-by: Mariana Bellorín Aguilera <[email protected]>
  • Loading branch information
3 people authored Nov 20, 2023
1 parent 725dda0 commit e6de7bd
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
title: Azion Edge Runtime and Node.js compatibility
description: Azion Edge Runtime and Node.js compatibility
meta_tags: edge, javascript
namespace: documentation_products_azion_runtime_node
permalink: /documentation/products/azion-edge-runtime/compatibility/node/
menu_namespace: runtimeMenu
---

import Button from '~/components/Button.astro'

The compatibility between **Azion Edge Runtime** and **Node.js** is an ongoing task, but a set of Node Runtime APIs are listed and are compatible with Azion Edge Runtime.

The compatibility is listed below:

## Node built-in

### [async_hooks](https://nodejs.org/api/async_hooks.html)

**Supported**: 🟡 Partially supported

**Comments**: only [AsyncLocalStorage](https://nodejs.org/api/async_context.html#class-asynclocalstorage) and [AsyncResource](https://nodejs.org/api/async_hooks.html#class-asyncresource) are implemented.

**Example**:

```javascript
import { AsyncLocalStorage } from "node:async_hooks";

const requestId = new AsyncLocalStorage();

async function logAsyncContext(state) {
console.log(`${requestId.getStore()} - ${state}`);
}

async function doSomething() {
logAsyncContext("log from async function");
doSomethingElse();
}

async function doSomethingElse() {
logAsyncContext("log from another async function");
}

async function handleRequest(request) {
const id = request.headers.get("X-Request-Id");

return requestId.run(id, async () => {
doSomething();
logAsyncContext("log from yet another async function");
requestId.exit(async () => {
logAsyncContext("log from exit callback");
});
return new Response("ok");
});
}

addEventListener("fetch", (event) => {
event.respondWith(handleRequest(event.request));
});
```

For additional compatibility information:

<Button href="/en/documentation/products/edge-application/edge-functions/runtime-apis/javascript/" text="go to supported Web APIs" variant="secondary" target="_blank"></Button>
<br />
<Button href="/en/documentation/products/devtools/azion-edge-runtime/frameworks-compatibility/" text="go to supported Web Frameworks" variant="secondary" target="_blank"></Button>


9 changes: 6 additions & 3 deletions src/i18n/en/runtimeMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@

/// START HERE :::: DO NOT REMOVE the strings above, it's a work around for header on mobile ///

{ text: 'Overview', header: true, anchor: true, type: 'learn', key: 'overview', slug: '/documentation/products/edge-application/edge-functions/runtime/overview' },
{ text: 'Overview', header: true, anchor: true, type: 'learn', key: 'overview', slug: '/documentation/products/edge-application/edge-functions/runtime/overview', hasLabel: 'menu.runtime' },
{ text: 'API Reference', header: true, type: 'learn', key: 'apiReference', children: [
{ text: 'Environment Variables', slug: '/documentation/products/edge-application/edge-functions/runtime/api-reference/environment-variables', key: 'runtime/variables' },
{ text: 'Web APIs', slug: '/documentation/products/edge-application/edge-functions/runtime-apis/javascript', key: 'runtime/web-standards' },
{ text: 'Metadata API', slug: '/documentation/products/edge-application/edge-functions/runtime/api-reference/metadata', key: 'runtime/metadata' },
{ text: 'Network List interface', slug: '/documentation/products/edge-application/edge-functions/runtime/api-reference/network-list', key: 'runtime/network-list' },
{ text: 'Web APIs', slug: '/documentation/products/edge-application/edge-functions/runtime-apis/javascript', key: 'runtime/web-standards' },
]},

{ text: 'Frameworks compatibility', header: true, anchor: true, type: 'learn', key: 'runtime/frameworks', slug: '/documentation/products/devtools/azion-edge-runtime/frameworks-compatibility/' },
{ text: 'Compatibility', header: true, type: 'learn', key: 'runtime/compatibility', children: [
{ text: 'Web frameworks', header: true, anchor: true, type: 'learn', key: 'runtime/frameworks', slug: '/documentation/products/devtools/azion-edge-runtime/frameworks-compatibility/' },
{ text: 'Node.js', header: true, anchor: true, type: 'learn', key: 'runtime/node', slug: '/documentation/products/azion-edge-runtime/compatibility/node/' },
]},

{ text: 'JavaScript Examples', header: true, anchor: true, type: 'learn', slug: '/documentation/products/edge-application/edge-functions/javascript-examples', key: 'runtime/jsExamples' },
{ text: 'Debugging', header: true, anchor: true, type: 'learn', slug: '/documentation/products/edge-application/edge-functions/debugging', key: 'runtime/debugging' },
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/en/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,6 @@ export default {
'topbar.message': 'Azion earns Frost & Sullivan’s 2023 North American New Product Innovation Award in the edge serverless industry.',
'topbar.link': 'https://www.azion.com/en/blog/azion-frost-sullivan-award/',
'topbar.cta': 'Check it out!',
'menu.runtime': 'Azion Edge Runtime',

};

0 comments on commit e6de7bd

Please sign in to comment.