MongoDB Atlas Function inconsistent behaviour between HTTPS call and debug run

My simple Atlas function is as follows:

exports = async function({ query, headers, body}, response) {

  // const {id} = await query;
  const id = "63a18506eeb4aa7b878751b5"
  const collection = await context.services.get("mongodb-atlas").db("GatherDB").collection("Project")
  const project = await collection.findOne({_id:BSON.ObjectId(id)})
  
  return project.name
};

When I call this function (impersonating a user) using the “run” button on Atlas Function editor I get the expect response, a project name for the given Id.

When I call this function via Postman passing the user authentication in headers I get this error:

{
    "error": "cannot compare to undefined",
    "error_code": "FunctionExecutionError",
    "link": "https://realm.mongodb.com/groups/637360845e9d607c6236bea6/apps/6373656a5122b133c4f719f1/logs?co_id=63ce65fe10282834d993ce0a"
}

I’m struggling to understand this inconsistent behaviour.