79234056

Date: 2024-11-28 13:26:37
Score: 4.5
Natty:
Report link

I hope my solution solves the issue you faced.

By default, process.env variables in Next.js are only available in the client and server-side code executed by Next.js. However, in your backend server, you need to ensure the environment variables are properly loaded.

Please try to use a .env.local file in the root of your project to define your environment variables.

In Next.js, environment variables used in the client-side code must start with NEXT_PUBLIC_. However, this does not apply to server-side code, including your database connection.

Ensure you are not adding the NEXT_PUBLIC_ prefix to MONGODB_URI, as it is meant for server-side usage.

Thanks in advance.

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • RegEx Blacklisted phrase (3): Thanks in advance
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: AnJun Luo