Occasional whitelist issues with new users on site - MongoDB

We have a site running on Next.js deployed on Vercel, with a MongoDB backend. Currently we have the issue where new users on the site get occasional 502/500 errors when they perform various functionality such as login, signup or viewing items. However, once they refresh the site it works fine again. When I checked the logs on Vercel, the issue appears as follows:

In MongoDB, I have set the Network Access to allow all addresses.
image

In addition, below is our connectDB function, and an example of where it is called. What might be causing this issue and how could it be resolved? Thanks

image
image

Hi Development_Team,

I’m sorry to hear you’re running into this issue. In order to help us investigate, can you share cluster tier are you using here (M0, M2, M10, etc?). Feel free to shoot an email to me at andrew.davidson at mongodb.com with a link to your Atlas project.

Thanks
-Andrew