Skip to content

TypeError: Object #<Pool> has no method 'on' #533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
apparatusdeus opened this issue Jul 5, 2013 · 7 comments
Closed

TypeError: Object #<Pool> has no method 'on' #533

apparatusdeus opened this issue Jul 5, 2013 · 7 comments

Comments

@apparatusdeus
Copy link

In the documentation on the main page there is a block that reads as follows:

pool.on('connection', function(err, connection) {
  connection.query('SET SESSION auto_increment_increment=1')
});

However when I run this code I receive the following error:
TypeError: Object # has no method 'on'

@reinaldorauch
Copy link

I'm with the 2.0.0-alpha8 version and keeps with this issue

@shaalin
Copy link

shaalin commented Aug 21, 2013

Having the same issue with 2.0.0.-alpha8, i have opened another issue for the same with the code I am using.

#561

@euglv
Copy link

euglv commented Aug 24, 2013

There is no "on" method in the documentation for 2.0.0-alpha8 version:
https://github.com/felixge/node-mysql/tree/v2.0.0-alpha8

To use this method you need to download master branch of node-mysql.

@euglv
Copy link

euglv commented Aug 24, 2013

When using master branch there is no error "TypeError: Object # has no method 'on'", but event is never called.

@nanek
Copy link
Contributor

nanek commented Oct 1, 2013

Note, per #599, the callback only has one parameter the connection.

pool.on('connection', function(connection) {});

Also note, there is a test for this event in master you can reference if it is still an issue. https://github.com/felixge/node-mysql/blob/master/test/integration/pool/test-connection-event.js

@dougwilson
Copy link
Member

This issue can be closed. The reason you are getting the error is because you are not using at least v2.0.0-alpha9 as before then, the pool object was not an event emitter, so it had no on method.

@kai-koch
Copy link
Collaborator

Feel free to reopen, if your problem still exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

7 participants