Skip to content


Subversion checkout URL

You can clone with
Download ZIP


ReferenceError: setImmediate is not defined #4

gflarity opened this Issue · 3 comments

3 participants


Hi, I just tried to use pg-cursor with a simple select:

setImmediate(function() {
ReferenceError: setImmediate is not defined
at Cursor._sendRows (/foo/tools/lib/node_modules/pg-cursor/index.js:51:3)
at Cursor.handlePortalSuspended (/foo/tools/lib/node_modules/pg-cursor/index.js:64:8)
at Client.connect.con.once.con.on.self.constructor.port (/foo/tools/lib/node_modules/pg/lib/client.js:112:24)
at EventEmitter.emit (events.js:96:17)
at Connection.attachListeners (/foo/tools/lib/node_modules/pg/lib/connection.js:97:12)
at Socket.EventEmitter.emit (events.js:96:17)
at TCP.onread (net.js:397:14)


What version of node are you using? Looks like setImmediate was added in v0.10:


Ah, yes we're using v0.8 and I guess that stopped being supported. Will need to bite the bullet and upgrade soon. We just haven't hit a compelling reason to do so yet.


You can also do this somewhere in code & it should work....

global.setImmediate = global.setImmediate || process.nextTick.bind(process)

I don't rely on any of the intricacies of setImmediate versus process.nextTick so you're safe to monkey-patch.

@brianc brianc closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.