{"record":{"id":"0871af85ba460ead","repo":"petkaantonov/bluebird","slug":"no-async-scheduler-available-see-http-goo-g","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/async.js","lineNumber":62,"sourceCode":"    }\n};\n\n// Must be used if fn can throw\nAsync.prototype.throwLater = function(fn, arg) {\n    if (arguments.length === 1) {\n        arg = fn;\n        fn = function () { throw arg; };\n    }\n    if (typeof setTimeout !== \"undefined\") {\n        setTimeout(function() {\n            fn(arg);\n        }, 0);\n    } else try {\n        this._schedule(function() {\n            fn(arg);\n        });\n    } catch (e) {\n        throw new Error(NO_ASYNC_SCHEDULER);\n    }\n};\n\n//When the fn absolutely needs to be called after\n//the queue has been completely flushed\nfunction AsyncInvokeLater(fn, receiver, arg) {\n    ASSERT(arguments.length === 3);\n    this._lateQueue.push(fn, receiver, arg);\n    this._queueTick();\n}\n\nfunction AsyncInvoke(fn, receiver, arg) {\n    ASSERT(arguments.length === 3);\n    this._normalQueue.push(fn, receiver, arg);\n    this._queueTick();\n}\n\nfunction AsyncSettlePromises(promise) {","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/petkaantonov/bluebird/blob/c220cfe480868e2f5c5de4fe8bb3b04b97588d7f/src/async.js#L44-L80","documentation":"This error is thrown by Bluebird's internal Async scheduler (src/async.js) when an asynchronous callback needs to be scheduled but no scheduler implementation (setImmediate, MutationObserver, MessageChannel, setTimeout, etc.) could be set up in the current environment. Bluebird needs a macrotask/microtask mechanism to flush its queue; if all detection fails, _schedule is missing and this Error is thrown. It means the runtime environment is not supported or has been sandboxed in a way that removed async scheduling primitives.","triggerScenarios":"Calling any Bluebird API that queues an async item in an environment where async.invokeLater/_schedule is undefined — typically exotic runtimes (restricted sandboxes, embedded JS engines, mocked test environments where setTimeout/setImmediate/MutationObserver/MessageChannel are all deleted) or a broken browser bundle where Bluebird failed to detect a scheduler.","commonSituations":"Running Bluebird inside Web Workers with unusual build configs, in restricted VM sandboxes (e.g. custom eval environments), in old browsers lacking every scheduler API, or in unit-test environments that stub out global timers and break Bluebird's scheduler detection.","solutions":["Verify setTimeout/setImmediate/MutationObserver/MessageChannel exist in the target environment; restore whichever is missing","Run Bluebird in a supported environment (Node.js or a modern browser) instead of a stripped-down sandbox","Check bundler configuration so globals (timers) are not polyfilled away or undefined in the bundle scope","Update Bluebird to a version supporting the runtime, or supply a custom scheduler build","If the error appears in tests, stop deleting/stubbing global timer functions before requiring Bluebird"],"exampleFix":"// before (test setup broke schedulers)\nglobal.setTimeout = undefined;\nconst Promise = require('bluebird');\n// after\nconst Promise = require('bluebird'); // keep timers intact, or restore before require\nglobal.setTimeout = require('timers').setTimeout;","handlingStrategy":"validation","validationCode":"function hasAsyncScheduler() {\n  return typeof setImmediate === 'function' ||\n    typeof setTimeout === 'function' ||\n    (typeof MutationObserver === 'function') ||\n    (typeof MessageChannel === 'function');\n}\nif (!hasAsyncScheduler()) throw new Error('Environment lacks async scheduler; Bluebird cannot run here');","typeGuard":"const schedulerSupported =\n  typeof globalThis.setImmediate === 'function' ||\n  typeof globalThis.setTimeout === 'function';","tryCatchPattern":"try {\n  return Promise.resolve(value);\n} catch (e) {\n  if (String(e.message).includes('No async scheduler')) {\n    return fallbackSyncPath(value); // avoid bluebird in this env\n  }\n  throw e;\n}","preventionTips":["Verify scheduler primitives exist before importing bluebird in sandboxed runtimes","Do not stub or delete global setTimeout/setImmediate in test setups","Test your bundle in the real target environment (worker, sandbox) early","Keep bluebird updated for new runtime scheduler support"],"tags":["scheduler","environment","async"],"backgroundTag":"missing-async-scheduler","analyzedSha":"c220cfe480868e2f5c5de4fe8bb3b04b97588d7f","analyzedAt":"2026-09-02T02:30:20.863Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}