You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'll soon work on a peace of software which uses pg-promise that also imports pg-native. I fixed this some time ago but it probably needs refinement. As it was I had this in the resolve section of my webpack.config.js:
// alias/pgpass.js
'use strict';
var fs = require('fs')
, helper = require( 'pgpass/lib/helper.js' )
;
module.exports.warnTo = helper.warnTo;
module.exports = function(connInfo, cb) {
var file = helper.getFileName();
fs.stat(file, function(err, stat){
if (err || !helper.usePgPass(stat, file)) {
return cb(undefined);
}
var st = fs.createReadStream(file);
helper.getPassword(connInfo, st, cb);
});
};
Reacted by Nikolay Kuchumov, Kuchiriel, Matthew, Kavi Siegel, Tony Franzese, Rogério Rodrigues de Alcântara, Michał Zalewski, Shaun Cutts, Lance McNearney, Jaymes Bearden and 6 more
For those experiencing this using serverless-bundle, and not wanting to migrate to serverless-webpack for their project. I have made this package for now: "serverless-bundle-no-pg-native": "1.3.0" which applies @thenikso's fix to the serverless-bundle repo. This will allow you to deploy your lambda function using pg by swapping the serverless-bundle plugin to serverless-bundle-no-pg-native
Reacted by Denis Shiriaev, Bahram Bagher, Kenneth Skovhus, Gary Griffin, Jeff Tham, Dan Coates, Sandipan, Dima Demakov, Adrien Brignon, Ian Sebastian and 19 more
Reacted by Denis Shiriaev, Sandipan, Adrien Brignon, Krishnakant Mishra, Max Pschonder, Max Rozen, Hieu Ho, Ilia Choly, Alexander Porrello and Matthew Endicott
Reacted by Denis Shiriaev, Sandipan, Adrien Brignon, Krishnakant Mishra, Max Pschonder, Max Rozen, Alex C., Hieu Ho, Ilia Choly, Alexander Porrello and 1 more
Activity
thenikso commentedon Jan 9, 2017
I'll soon work on a peace of software which uses
pg-promisethat also importspg-native. I fixed this some time ago but it probably needs refinement. As it was I had this in theresolvesection of mywebpack.config.js:And the files are:
rentrop commentedon Jan 10, 2017
Perfect, thanks.
vitaly-t commentedon Jan 12, 2017
While pg-promise fully supports pg-native, the real performance gain is negligible, especially under the new versions of Node.js
adieuadieu commentedon Jul 17, 2018
Another solution (if using webpack), is to add
new webpack.IgnorePlugin(/^pg-native$/)to your webpack config's plugins array. E.g.aychtang commentedon Aug 11, 2019
For those experiencing this using
serverless-bundle, and not wanting to migrate to serverless-webpack for their project. I have made this package for now: "serverless-bundle-no-pg-native": "1.3.0" which applies @thenikso's fix to the serverless-bundle repo. This will allow you to deploy your lambda function using pg by swapping the serverless-bundle plugin toserverless-bundle-no-pg-nativeYou can check the diff at https://github.com/aychtang/serverless-bundle. I will not be maintaining this so it will stay at the current version of serverless-bundle, but I thought it'd be useful to share if people are doing some small projects and want to save some time.
TLDR:
npm i serverless-bundle-no-pg-native --save-dev.serverless-bundle-no-pg-native.databyte commentedon Mar 26, 2020
Just came across this, if you're using
serverless-bundle, add this to your serverless.ymlSee: https://www.npmjs.com/package/serverless-bundle#pg
joinnusdev commentedon Aug 15, 2020
that works for me, thanks
getkey commentedon Nov 1, 2020
If you are using Webpack 5 the API of
IgnorePluginchanged so @adieuadieu's code needs a little tweak.alecsci commentedon Jun 14, 2021
Thanks @getkey. It worked !
bibhuticoder commentedon Feb 2, 2022
Thanks. Saved my day
yulei-chen commentedon Jul 20, 2022
If you are using
serverless-esbuild, add this to your serverless.yml:See: https://www.npmjs.com/package/serverless-esbuild#configuration
alexporrello commentedon Feb 13, 2023
You're the best! Thank you!