Home > Net >  pgtypes.fetcher is not a function
pgtypes.fetcher is not a function

Time:09-24

I have been trying to implement pg-postgis-types npm package in my express project for my internship. I'm using PostgreSQL and Sequelize.

Unfortunately, although I have implemented the code in the documentation, our API returns pgtypes.fetcher is not a function. Does anyone encounter with this issue? I checked the definition of the package in node modules folder and I found the definition, as it should be.

To be a reference, my code is like below.

const getgeojson = async (mapID) => {
    try {
        postgis(pgtypes.fetcher(pg, connection), null, (err, oids) => {
            if (err) {
                throw err;
            };  ...

I know this is not a much popular repo but maybe someone encounter and solved it before, I just wanted to ask. Sorry if this is a bad question :)

CodePudding user response:

The package is much older, thus, the usage is slightly different from the original documentation in both npm and GitHub repo. You can call functions by changing postgisto postgis.default and pgtypes.fetcher to pgtypes.default.fetcher. This solved my stated issue above. Have a nice day y'all.

  • Related