Skip to content

Conversation

@vinnyjth
Copy link

@vinnyjth vinnyjth commented Oct 11, 2020

Fixes an error I ran into w/ knex. Knex expects both the err and the connection argument.

https://github.com/knex/knex/blob/master/lib/dialects/postgres/index.js#L111

Stacktrace I ran into when integrating into my app:

TypeError Cannot read property 'on' of undefined 
    node_modules/knex/lib/dialects/postgres/index.js:116:20 
    node_modules/@scout_apm/scout-apm/dist/lib/integrations/pg.js:39:25 Client.originalConnectFn.apply.err [as _connectionCallback]
    node_modules/pg/lib/client.js:270:14 Client._handleReadyForQuery

I'm not familiar with your testing framework. Is this something you want tests for?

@vinnyjth vinnyjth changed the title Adds 'connection' to postgres user callback Adds 'connection' to postgres connection user callback Oct 11, 2020
@ghost
Copy link

ghost commented Oct 11, 2020

Hey @vinnyjth thanks for finding this! How do you feel about using something like userCallback.apply(this, arguments) and changing the arrow function to a normal function?

[EDIT] Also I'd love to get a chance to make sure that the traces are working for you while using knex! Please let me know if you run into any other issues (you could join the slack or just make an issue/PR as well!)

@ghost ghost mentioned this pull request Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant