MongoDB Atlas triggers don't work with Neo4j driver

My goal is to create an Atlas triggers to synchronize my MongoDB database with a Neo4j (Aura) database. The function I wrote works fine on my computer, however, when called by the trigger it throws this error:

TypeError: Configured resolver function should either return an array of addresses or a Promise resolved with an array of addresses.Each address is '<host>:<port>'. Got: [object Promise]

This is the function:

(async () => {
  const neo4j = require("neo4j-driver");

  const uri = "neo4j+s://d3dc4645.databases.neo4j.io";
  const user = "neo4j";
  const password = "...";

  const driver = neo4j.driver(uri, neo4j.auth.basic(user, password));
  const session = driver.session();

  const id = "TEST"
  
  const writeQuery = `MERGE (p1:User {id:$id })`;
  await session.writeTransaction((tx) => tx.run(writeQuery, { id }));
  await driver.close();
})();

In the trigger it is like this (this doesn’t work):

exports = async function(changeEvent) {

  const neo4j = require("neo4j-driver");

  const uri = "neo4j+s://d3dc4645.databases.neo4j.io";
  const user = "neo4j";
  const password = "...";

  const driver = neo4j.driver(uri, neo4j.auth.basic(user, password));
  const session = driver.session();

  const id = "TEST"
  
  const writeQuery = `MERGE (p1:User {id:$id })`;
  await session.writeTransaction((tx) => tx.run(writeQuery, { id }));
  await driver.close();
};

What am I doing wrong? (I don’t think it is something related to neo4j driver but maybe something about the handling of promises)

Thanks.