Skip to content
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

this.lib.Client is not a constructor when using pg-native #734

Open
dberardo-com opened this issue Sep 5, 2023 · 3 comments
Open

this.lib.Client is not a constructor when using pg-native #734

dberardo-com opened this issue Sep 5, 2023 · 3 comments

Comments

@dberardo-com
Copy link

what am i trying to achieve? --> connecting to an older version of postgres (< 9)

which version of sequelize am i using ? --> 6.32

by looking at: https://sequelize.org/releases/#postgresql-support-table i understand pg-native should be the way to go.

so i am initializing sequelize with:

options.dialectModule = require("pg-native")

ref (https://sequelize.org/api/v6/class/src/sequelize.js~sequelize)

but this leads to this error:

this.lib.Client is not a constructor

@dberardo-com
Copy link
Author

the error log seems to have changed:

"Cannot read properties of undefined (reading 'on')"

what i did is using this option:

"require('pg').native"

ref: brianc/node-pg-native#119

@ephys
Copy link
Member

ephys commented Mar 26, 2024

Have you tried the following?

new Sequelize({
  dialect: 'postgres',
  native: true,
})

We use pg.native instead of pg automatically if that option is provided: https://github.com/sequelize/sequelize

@ephys
Copy link
Member

ephys commented Mar 28, 2024

Turning this into a documentation issue as I assume that's what went wrong

@ephys ephys transferred this issue from sequelize/sequelize Mar 28, 2024
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

No branches or pull requests

2 participants