---
title: "Comment by KENNETH  on \"Next JS - MongoDB Connection\" | Hashnode"
description: "I am getting the error &quot;Server Error TypeError: Cannot read properties of undefined (reading &#39;prototype&#39;) This error happened while generating the"
url: "https://hashnode.com/posts/next-js-mongodb-connection/6426da911bc71ef1cf980677/comment/64276cf0af5048c992b6e570"
---

[Discussion](https://hashnode.com/posts/next-js-mongodb-connection/6426da911bc71ef1cf980677)

Comment [Next JS - MongoDB Connection](https://hashnode.com/posts/next-js-mongodb-connection/6426da911bc71ef1cf980677)

[KENNETH](https://hashnode.com/@devkenny)

[Mar 31, 2023](https://hashnode.com/posts/next-js-mongodb-connection/6426da911bc71ef1cf980677/comment/64276cf0af5048c992b6e570)

I am getting the error "Server Error TypeError: Cannot read properties of undefined (reading 'prototype')

This error happened while generating the page. Any console logs will be displayed in the terminal window.

[Manas Krishna Jaiswal](https://hashnode.com/@bosoniqueit)

[Apr 1, 2023](https://hashnode.com/posts/next-js-mongodb-connection/6426da911bc71ef1cf980677/comment/64276cf0af5048c992b6e570#reply-64279aa1318b4dd1473106b3)

Hi, this error generally occurs when env variables are not properly defined. Please do check that once and also provide screent shot of error so that i can go through it.
