Cam Sloan
01/14/2022, 7:40 PMpg
npm package to make the connection. I have also tried using serverless-postgres
with the same results.
I am getting an error about not able to resolve pg-native.
> node_modules/pg/lib/native/client.js:4:21: error: Could not resolve "pg-native" (mark it as external to exclude it from the bundle, or surround it with try/catch to handle the failure at run-time)
the code implementation looks like:
const { Pool } = require('pg')
// import ServerlessClient from 'serverless-postgres'
const pool = new Pool({
user: process.env.DB_USER,
host: process.env.DB_HOST,
database: process.env.DB_NAME,
password: process.env.DB_PASSWORD,
port: Number(process.env.DB_PORT),
debug: true,
delayMs: 3000,
})
Any help would be greatly appreciated!const api = new Api(this, 'TriggerVideoMigrationsApi', {
defaultFunctionProps: {
bundle: {
externalModules: ['pg-native'],
},
},
routes: {
// ...
},
})
Frank
01/14/2022, 10:44 PMWilliam Hatch
01/24/2022, 8:17 PMFrank
01/24/2022, 8:39 PMWilliam Hatch
01/28/2022, 6:27 PMFrank
01/30/2022, 4:29 AMbike-bill
01/30/2022, 10:19 AMWilliam Hatch
02/03/2022, 7:17 PM