IAM AWS doesn't work on managed serverless platform

currently we are using Vercel as backend in our app and we were using IAM AWS as passwordless authentication[1] but it stopped work with a recent update. I believe that the way I was using was working by chance and not by design.

To give some context Vercel runs currently on Lambda and we aren’t supposed to use or manipulate the AWS Credentials. The MongoDB nodejs driver will use them by default and there is no way to unset the AWS_SESSION_TOKEN.[2]

Previously I was doing something like this till the code change.

Ideally it would be nice to do something like this to unset it by checking if it was strictly undefined.

Is this something that will be ever be supported or do you have any other ideas on how to solve this issue besides requesting a real AWS_SESSION_TOKEN to pass?

Sorry if this is the wrong place to post this, if there is a better place for questions, please feel free to point me to it.

[2]node-mongodb-native/mongo_credentials.js at 3.6 · mongodb/node-mongodb-native · GitHub (the same behavior still exists on 4 last time I checked)