I have an Auth0 SPA that I would like to link to an RDS Postgres custom database. I have set up the custom database in the Authentication>Database section of the dashboard, but am struggling to successfully implement the necessary Database Action Scripts.
When I import and “Save And Try” the template PostgreSQL scripts provided by Auth0, I keep receiving an error stating “[SandboxUnhandledError] postgres.connect is not a function”. I have updated the script with my RDS details, but still receive this error (which seems to be a node-postgres library issue?).
Any help on this would be much appreciated, super frustrating that the template script doesn’t work
The error that you are facing is usually resolved by specifically indicating the version of the ‘pg’ package that is being used in your DB Script, according to the Node runtime version used in your tenant. You can get the versions to use by looking at Can I require? - Search which node modules you can use in webtask.io.
In this sense, you will need to add the ‘pg’ version under a similar format ( the following example is for Node 22) :