Promises & Iteration
Promises, generators, async functions, and the ES6 iteration protocol are not available in SSJS. The SFMC Jint engine predates ES2015 and runs synchronously, so Promise, Iterator, Generator, and all async variants are undefined.
Promises, generators, async functions, and the iteration protocol are not available in SSJS. The SFMC server-side JavaScript engine (Jint) implements an ES3/ES5-era dialect, predates ES2015, and executes synchronously — there is no event loop or microtask queue. Promise, Iterator, Generator, GeneratorFunction, and every async variant are undefined, and new Promise(...) throws Unknown type: Promise.
Status legend
| Icon | Meaning |
|---|---|
| ❌ Missing | Not available (typeof is "undefined"; construction throws) |
Members
| Member | ES | Status | Notes |
|---|---|---|---|
Promise |
ES6 | ❌ Missing | Engine is synchronous — no .then/await |
Iterator |
ES6 | ❌ Missing | No iteration protocol; use index loops |
Generator |
ES6 | ❌ Missing | function* syntax is not supported |
GeneratorFunction |
ES6 | ❌ Missing | — |
AsyncFunction |
ES2017 | ❌ Missing | async/await unsupported |
AsyncGenerator |
ES2018 | ❌ Missing | — |
AsyncGeneratorFunction |
ES2018 | ❌ Missing | — |
AsyncIterator |
ES2018 | ❌ Missing | — |
Promise
(ES6) — ❌ Missing. Promise is not defined — typeof Promise === "undefined" and new Promise(function(resolve){ resolve(1); }) throws Unknown type: Promise.
The SSJS engine runs synchronously, so asynchronous flow control is neither needed nor available. All Platform and HTTP calls are blocking — write straight-line code and read return values directly:
// No Promise/await — HTTP calls return synchronously.
var resp = HTTP.Get("https://postman-echo.com/get");
Write(resp.StatusCode); // available immediately
Iterator
(ES6) — ❌ Missing. Iterator is not defined. Because Symbol is also absent, there are no well-known symbols and therefore no iterator protocol — for…of, spread, and destructuring over iterables are unavailable. Iterate arrays with a classic index loop:
for (var i = 0; i < arr.length; i++) {
Write(arr[i] + "\n");
}
Generator
(ES6) — ❌ Missing. Generator is not defined, and the function* / yield generator syntax is not supported by the engine’s parser. Return a fully-materialised array instead of yielding lazily.
GeneratorFunction
(ES6) — ❌ Missing. GeneratorFunction (the hidden constructor of generator functions) is not defined.
Async variants
(ES2017+) — ❌ Missing. AsyncFunction, AsyncGenerator, AsyncGeneratorFunction, and AsyncIterator are all not defined. The async / await keywords are not supported. Since the engine is synchronous, model any “async” work as ordinary blocking calls.