This is likely because you have not connected to your database
use the line
database.connect()
and do not forget the async keyword as mentioned in the previous answer in the thread.
async database.connect()