Custom JWT Authentication trigger not inserting and cannot debug

You have const user = authEvent; instead of const user = authEvent.user; ? Maybe that’s a problem?
I don’t use Custom JWT Authentication myself but Custom Function Authentication.
However I have the exact same trigger setting and function setting as you.

Did you try to remove ALL the code except just a console.log(“hello world”) and see if you get logs or not? If this works, try to debug it until you find the culprit line.

Also when declaring the main function async, you have to use “await” with mongo async function like
const result = await collection.insertOne(newUser);

Another thing is that I don’t understand why you put “insertedId” between brackets? I don’t think collection.insertOne(newUser) returns a document but only a string variable (the id). Maybe try without the brackets.