Hi @anosh
Welcome to the Auth0 Community!
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) :
const postgres = require('pg@8.7.1')
Adding to the above, this has been mentioned in the following post as well : Own database PostgresSQL no longer functionall - #3 by vdgandrew
Hope this helped!
Gerald