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"mongodb-atlas").db("GatherDB").collection("Project")
  const project = await collection.findOne({_id:BSON.ObjectId(id)})

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": ""

I’m struggling to understand this inconsistent behaviour.