{"record":{"id":"f89868ea96fe2692","repo":"petkaantonov/bluebird","slug":"no-async-scheduler-available-see-http-goo-g-f89868","errorCode":null,"errorMessage":"No async scheduler available\n\n    See http://goo.gl/MqrFmX\n","messagePattern":"No async scheduler available\n\n    See http://goo\\.gl/MqrFmX\n","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"src/schedule.js","lineNumber":5,"sourceCode":"\"use strict\";\nvar util = require(\"./util\");\nvar schedule;\nvar noAsyncScheduler = function() {\n    throw new Error(NO_ASYNC_SCHEDULER);\n};\nvar NativePromise = util.getNativePromise();\n// This file figures out which scheduler to use for Bluebird. It normalizes\n// async task scheduling across target platforms. Note that not all JS target\n// platforms come supported. The scheduler is overridable with `setScheduler`.\n\n// Our scheduler for Node.js/io.js is setImmediate for recent\n// versions of node because of macrotask semantics.\n// The `typeof` check is for an edge case with nw.js.\nif (util.isNode && typeof MutationObserver === \"undefined\") {\n    var GlobalSetImmediate = global.setImmediate;\n    var ProcessNextTick = process.nextTick;\n    schedule = util.isRecentNode\n                ? function(fn) { GlobalSetImmediate.call(global, fn); }\n                : function(fn) { ProcessNextTick.call(process, fn); };\n} else if (typeof NativePromise === \"function\" &&\n           typeof NativePromise.resolve === \"function\") {\n    var nativePromise = NativePromise.resolve();","sourceCodeStart":1,"sourceCodeEnd":23,"githubUrl":"https://github.com/petkaantonov/bluebird/blob/c220cfe480868e2f5c5de4fe8bb3b04b97588d7f/src/schedule.js#L1-L23","documentation":"Bluebird needs an asynchronous scheduler (setImmediate, MutationObserver, etc.) to run promise callbacks. `noAsyncScheduler` (src/schedule.js:5) is the fallback installed when NO scheduling primitive is detected; invoking it throws \"No async scheduler available\". This means the runtime platform exposes none of the supported async mechanisms.","triggerScenarios":"Running in a sandboxed/locked-down environment (some WebViews, restricted workers, odd embedded JS engines) where setImmediate, MessageChannel, MutationObserver, and setTimeout-based fallbacks are all unavailable or stripped.","commonSituations":"Bundled code with aggressive polyfill stripping; exotic environments (React Native older builds, sandboxed eval contexts, custom JS engines); CSP blocking MutationObserver-style tricks.","solutions":["Set a scheduler explicitly: `Promise.setScheduler(fn => setTimeout(fn, 0))`.","Polyfill a scheduling primitive (e.g. setImmediate or Promise) before loading Bluebird.","Update the environment/runtime to one with native scheduling support; check bundler config isn't stripping globals."],"exampleFix":"// before\nconst Promise = require('bluebird');\n// after\nconst Promise = require('bluebird');\nif (typeof setImmediate === 'undefined') {\n  Promise.setScheduler((fn) => setTimeout(fn, 0));\n}","handlingStrategy":"fallback","validationCode":"const hasScheduler = typeof setImmediate === 'function' ||\n  typeof setTimeout === 'function' ||\n  typeof MutationObserver === 'function' ||\n  typeof MessageChannel === 'function';\nif (!hasScheduler) {\n  Promise.setScheduler((fn) => { fn(); }); // last-resort sync fallback (cooperative)\n}","typeGuard":"const hasAsyncScheduling = () => typeof setImmediate === 'function' || typeof setTimeout === 'function';","tryCatchPattern":"try {\n  const p = Promise.resolve(1); await p;\n} catch (e) {\n  if (String(e).includes('No async scheduler')) {\n    Promise.setScheduler((fn) => setTimeout(fn, 0));\n  } else throw e;\n}","preventionTips":["Smoke-test promise scheduling early in exotic environments.","Call Promise.setScheduler with a setTimeout fallback in sandboxed runtimes.","Check bundler/CSP settings that strip or block scheduling globals."],"tags":["environment","scheduler","runtime"],"backgroundTag":"no-async-scheduler","analyzedSha":"c220cfe480868e2f5c5de4fe8bb3b04b97588d7f","analyzedAt":"2026-09-02T02:30:20.863Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}