Getting 526 error while using cloufare mongodb worker

I have hosted my nextjs project in cloudfare and needs mongodb connection. I have followed exactly what is mentioned in the official community

However while accessing the api i get 526 error

HTTP/1.1 500 Internal Server Error Date: Tue, 13 Jun 2023 04:52:20 GMT Content-Type: application/json Content-Length: 191 Connection: keep-alive Report-To: {"endpoints":[{"url":"https:\/\/[](\/report\/v3?s=cp9HXB9ePQgTJWPhN5Itf%2BoDvZzQMpTDePYFCQQNDG9YmV6c8dqb%2BJoNJuHhT7m5yUDk6CwmU3M8gJEWOWGDYk2lrG%2FKYSTYhZqY0%2F9a1GndKZvx1HoysnBarY314PPphg%3D%3D"}],"group":"cf-nel","max_age":604800} NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800} Vary: Accept-Encoding Server: cloudflare CF-RAY: 7d67b9376a584309-EWR alt-svc: h3=":443"; ma=86400 { "error": "Error with authentication. Error: Request failed (POST (status 526)" }

I have tried with both custom domain and free domain