General
Troubleshooting

Troubleshooting

Common troubles and their solutions.

Find answers to questions other developers have asked - it might be just what you need!

Common Issues

Environment variables from .env are not being loaded

Make sure you are running the npm run dev command from the root directory of your project (where the package.json file is located).

Also make sure that the environment variable you are trying to access in your application is prefixed with NEXT_PUBLIC_ if you want to use it in client-side code.

Application is very slow in production

The most common reason for a slow application in production is the physical distance between the server or serverless functions and the database.

Make sure to deploy your application to a region that is close to your database. For example when you are using Vercel, you can select the region of the Vercel serverless functions in the project settings under the Functions tab.

Database connection issues

If you're experiencing database connection issues:

  1. Verify your DATABASE_URL in .env is correct
  2. Make sure your database is running and accessible
  3. Check if your database allows connections from your IP address (for managed databases)
  4. Verify the database credentials are correct

Port already in use

If port 3000 is already in use, you can change it by setting the PORT environment variable:

Terminal
PORT=3001 npm run dev