Ability to force *not* loading native client
See original GitHub issuenode-postres supports setting NODE_PG_FORCE_NATIVE
to force the loading of the native client, but there’s no way to force it to not load the native client:
if (typeof process.env.NODE_PG_FORCE_NATIVE !== 'undefined') {
module.exports = new PG(require('./native'))
} else {
module.exports = new PG(Client)
// lazy require native module...the native module may not have installed
module.exports.__defineGetter__('native', function () {
delete module.exports.native
var native = null
try {
native = new PG(require('./native'))
} catch (err) {
if (err.code !== 'MODULE_NOT_FOUND') {
throw err
}
/* eslint-disable no-console */
console.error(err.message)
/* eslint-enable no-console */
}
module.exports.native = native
return native
})
}
This can cause spurious warnings about pg-native module not found. See https://github.com/sequelize/sequelize/issues/3781 for an example caused by cloning node-postgres objects.
Potential solution: support a NODE_PG_NO_LOAD_NATIVE
environment variable. Setting this would cause the native
getter to not be defined. Setting both NODE_PG_NO_LOAD_NATIVE
and NODE_PG_FORCE_NATIVE
could throw an error.
I’m happy to throw together a PR if there’s support for something like this.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:13
- Comments:15 (2 by maintainers)
Top Results From Across the Web
Frequently Asked Questions - Chrome Developers
This document answers some frequently asked questions about Native Client (NaCl) and Portable Native Client (PNaCl, pronounced “pinnacle”).
Read more >How to fix 8 common remote desktop connection problems
First, try to establish a session from a client that has been able to successfully connect in the past. The goal is to...
Read more >Can't run "npm install expo-cli --global"
open start > search for cmd > right click on cmd and click run as administrator > Now npm i -g expo-cli this...
Read more >How to troubleshoot non-browser apps that can't sign in to ...
The keyboard on the client computer keyboard is working correctly, and the user name and the password were entered correctly. Non-browser app authentication ......
Read more >Native Client Launchers - Ignition User Manual 7.9
The Ignition Gateway contains downloadable native executables that can launch Clients directly without invoking Java Web Start.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
As of pg 8.0,
native
isn’t enumerable. (Cloning modules still sounds like a bug in sequelize or in the use of sequelize, though.)That would be a much bigger breaking change. I think simply making
native
non-enumerable, as proposed in #1992, solves all of the issues that I am aware of without breaking all but the most contrived usages.