{"record":{"id":"a3ab123f2af50030","repo":"vuejs/vue","slug":"your-javascript-runtime-does-not-support-any-async","errorCode":null,"errorMessage":"Your JavaScript runtime does not support any asynchronous primitives that are required by vue-server-renderer. Please use a polyfill for either Promise or setTimeout.","messagePattern":"Your JavaScript runtime does not support any asynchronous primitives that are required by vue-server-renderer\\. Please use a polyfill for either Promise or setTimeout\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/server-renderer/src/write.ts","lineNumber":14,"sourceCode":"const MAX_STACK_DEPTH = 800\nconst noop = _ => _\n\nconst defer =\n  typeof process !== 'undefined' && process.nextTick\n    ? process.nextTick\n    : typeof Promise !== 'undefined'\n    ? fn => Promise.resolve().then(fn)\n    : typeof setTimeout !== 'undefined'\n    ? setTimeout\n    : noop\n\nif (defer === noop) {\n  throw new Error(\n    'Your JavaScript runtime does not support any asynchronous primitives ' +\n      'that are required by vue-server-renderer. Please use a polyfill for ' +\n      'either Promise or setTimeout.'\n  )\n}\n\nexport function createWriteFunction(\n  write: (text: string, next: Function) => boolean,\n  onError: Function\n): Function {\n  let stackDepth = 0\n  const cachedWrite = (text, next) => {\n    if (text && cachedWrite.caching) {\n      cachedWrite.cacheBuffer[cachedWrite.cacheBuffer.length - 1] += text\n    }\n    const waitForNext = write(text, next)\n    if (waitForNext !== true) {\n      if (stackDepth >= MAX_STACK_DEPTH) {","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/src/write.ts#L1-L32","documentation":"Thrown at module-load time by write.ts when the defer primitive cannot be resolved. defer is chosen from process.nextTick, then Promise.resolve().then, then setTimeout; if all are undefined, defer falls back to noop and the guard throws. vue-server-renderer relies on deferring render continuation to avoid stack overflows (MAX_STACK_DEPTH = 800), so without an async primitive it cannot function. This is an environment-compatibility error.","triggerScenarios":"Loading vue-server-renderer in a JavaScript runtime that has none of: process.nextTick, native Promise, setTimeout. This is exotic — most Node and browser environments have at least one. Seen in stripped-down JS engines, some edge-case Nashorn/JVM JS runtimes, or environments where these globals were deleted/polyfill-blocked.","commonSituations":"Running SSR in a constrained sandbox that removes global timers/Promise for security. A JS engine embedded in a non-browser/non-Node host (e.g. a database stored-procedure JS engine) without async primitives. A bundler/misconfigured environment that tree-shook or stubbed out Promise/setTimeout.","solutions":["Polyfill at least one: global.Promise = require('es6-promise').Promise or global.setTimeout = ... before requiring vue-server-renderer.","Run in a standard Node.js environment (all three primitives are native).","If in a custom embedding, expose nextTick/setTimeout/Promise on the global scope before loading the module.","Avoid stripping globals in security sandboxes; instead run SSR in an isolated but complete Node process."],"exampleFix":"// before — runtime lacks async primitives, require throws\nconst VueSSR = require('vue-server-renderer')\n\n// after — polyfill before require\nglobal.Promise = global.Promise || require('core-js-pure/features/promise')\nglobal.setTimeout = global.setTimeout || require('timers').setTimeout\nconst VueSSR = require('vue-server-renderer')","handlingStrategy":"fallback","validationCode":"function assertAsyncPrimitivesAvailable(): void {\n  const has =\n    (typeof process !== 'undefined' && typeof process.nextTick === 'function') ||\n    typeof Promise === 'function' ||\n    typeof setTimeout === 'function'\n  if (!has) {\n    throw new Error(\n      'Environment lacks process.nextTick, Promise, and setTimeout. Polyfill at least one before loading vue-server-renderer.'\n    )\n  }\n}\n\nassertAsyncPrimitivesAvailable()\nrequire('vue-server-renderer')","typeGuard":"function environmentSupportsAsync(): boolean {\n  return (\n    (typeof process !== 'undefined' && typeof process.nextTick === 'function') ||\n    typeof Promise === 'function' ||\n    typeof setTimeout === 'function'\n  )\n}","tryCatchPattern":"// Thrown at module-load (require) time — wrap the require in try/catch:\nlet VueSSR\ntry {\n  VueSSR = require('vue-server-renderer')\n} catch (e) {\n  if (e.message.includes('does not support any asynchronous primitives')) {\n    global.Promise = global.Promise || require('core-js-pure/features/promise')\n    VueSSR = require('vue-server-renderer')\n  } else {\n    throw e\n  }\n}","preventionTips":["Run SSR in a standard Node.js environment which has all three async primitives natively.","Before loading vue-server-renderer in custom runtimes, polyfill Promise or setTimeout on the global scope.","Do not strip globals in security sandboxes; isolate via process instead.","Add an environment smoke test in CI that requires vue-server-renderer and catches load-time errors."],"tags":["ssr","runtime","polyfill","environment","async"],"analyzedSha":"9e88707940088cb1f4cd7dd210c9168a50dc347c","analyzedAt":"2026-08-11T22:22:01.295Z","schemaVersion":2},"datasetVersion":"2026-08-12T04:17:13.124Z"}