How to use PostgreSQL in your serverless app

Link to chapter —

Trying to use Postgres RDS with SST. Added the following but now it won’t deploy with npx sst deploy. Get the following error.

npm i pg

var Native = require('pg-native')
  ╵                      ~~~~~~~~~~~

There was a problem transpiling the Lambda handler.

Is SST meant to be used with RDS? If so, does Webpack or ESBuild need to be installed in order to exclude pg-native?

Yeah I recall something like this was brought up in: Slack

You’ll likely need to exclude it from bundling in esbuild: Function | Serverless Stack (SST)