# dt-js-runtime

Reference for writing server-side JavaScript functions that run on the Dynatrace platform, including runtime limits, Web APIs, and SDK packages.

Skill by Dynatrace. Category: Web and browsers.

## Install

Project (for this project only):

```sh
npx skills add dynatrace/dynatrace-for-ai --skill dt-js-runtime
```

Works with: Claude Code, Codex CLI, Cursor, Antigravity, Copilot CLI, opencode.

Global (for every project on this machine):

```sh
npx skills add dynatrace/dynatrace-for-ai --skill dt-js-runtime -g
```

Works with: Claude Code, Codex CLI, Cursor, Antigravity, Copilot CLI, opencode.

## Tags

- Runs on your computer: It runs as a program on your machine, with your access.

## Security audits

- Gen Agent Trust Hub: Pass
- Socket: Pass
- Snyk: Pass

Installs: 1552. Installs counted by skills.sh. [Open on skills.sh](https://www.skills.sh/dynatrace/dynatrace-for-ai/dt-js-runtime)

## Source

[Open the source](https://github.com/dynatrace/dynatrace-for-ai/tree/HEAD/skills/dt-js-runtime). Checked 2026-10-10. This summary may contain AI-generated text, so it can be wrong. Check the source before you rely on it.

## SKILL.md

````markdown
---
name: dt-js-runtime
description: Dynatrace server-side JS runtime — function contract, runtime limits, Web APIs, Node.js modules, fetch with credential vault, and the @dynatrace-sdk/* catalog.
license: Apache-2.0
---

# Dynatrace JavaScript Runtime

The Dynatrace JS runtime is a server-side AppEngine sandbox that executes JavaScript/TypeScript.

## Function contract

Every entry point must export a default async function:

```js
export default async function () {
  // ...
  return result;
}
```

ES module syntax required. TypeScript accepted (type annotations, interfaces, generics). No other export shape is supported.

## References

Start here, then load only the file you need.

| File | When to load |
|------|-------------|
| [references/limits-and-restrictions.md](references/limits-and-restrictions.md) | Timeout / memory / I/O quotas; what's forbidden (`eval`, WebSocket, sockets, filesystem) |
| [references/apis-and-modules.md](references/apis-and-modules.md) | Which Web APIs and Node.js compat modules are available (fetch, crypto, streams, buffer, …) |
| [references/fetch.md](references/fetch.md) | Calling internal `/platform/...` APIs or external URLs, credential vault, outbound allowlist |
| [references/sdk.md](references/sdk.md) | Any `@dynatrace-sdk/*` package — the index routes you to the right per-SDK file |

## Running a function with dtctl

Use `dtctl exec function` to run JS runtime code without deploying an app.

```dtctl
# Run inline code
dtctl exec function --code 'export default async function() { return "hello" }'

# Run from file
dtctl exec function -f script.js

# Pass JSON input — the parsed object is the function's argument
dtctl exec function -f script.js --payload '{"key":"value"}'
```

The function may accept an optional parameter. `--payload` is parsed and passed
as that argument directly — it is not wrapped in an `event.payload` field:

```js
export default async function(payload) {
  // with --payload '{"key":"value"}', payload is {"key": "value"}
  return payload.key;
}
```

Load the **`dynatrace-control`** skill for authentication setup, context switching, and the full `exec function` reference.
````

- Previous: [dt-alerting](https://syn4pse.dev/terminal/dt-alerting.md)
- Next: [dt-platform-costs](https://syn4pse.dev/terminal/dt-platform-costs.md)
- [Terminal](https://syn4pse.dev/terminal.md)
- [Suggest a change](mailto:terminal@syn4pse.dev?subject=Terminal%20suggestion)
