next-forge icon indicating copy to clipboard operation
next-forge copied to clipboard

Error when starting for the first time

Open PierrickLozach opened this issue 1 year ago • 5 comments

I get this error when I run pnpm dev and go to http://localhost:3000:

Import trace for requested module:
app:dev: ../../node_modules/.pnpm/[email protected]/node_modules/picocolors/picocolors.js
app:dev: ../../node_modules/.pnpm/[email protected][email protected]_@[email protected]_@[email protected]__@[email protected][email protected]_/node_modules/tailwindcss/lib/featureFlags.js
app:dev: ../../node_modules/.pnpm/[email protected][email protected]_@[email protected]_@[email protected]__@[email protected][email protected]_/node_modules/tailwindcss/lib/util/getAllConfigs.js
app:dev: ../../node_modules/.pnpm/[email protected][email protected]_@[email protected]_@[email protected]__@[email protected][email protected]_/node_modules/tailwindcss/lib/public/resolve-config.js
app:dev: ../../node_modules/.pnpm/[email protected][email protected]_@[email protected]_@[email protected]__@[email protected][email protected]_/node_modules/tailwindcss/resolveConfig.js
app:dev: ../../packages/tailwind-config/index.ts
app:dev: ../../packages/auth/provider.tsx
app:dev:  ⨯ next/dist/src/lib/is-error.ts (60:10) @ getProperError
app:dev:  ⨯ Error: [object Object]
app:dev:     at AsyncLocalStorage.run (node:async_hooks:346:14)
app:dev: digest: "4014698488"
app:dev:   58 |   }
app:dev:   59 |
app:dev: > 60 |   return new Error(isPlainObject(err) ? safeStringify(err) : err + '')
app:dev:      |          ^
app:dev:   61 | }
app:dev:   62 |
app:dev:  GET / 500 in 82466ms

next-forge version I am using version 2.3.10

To Reproduce Follow the setup instructions. Add environment variables

Screenshots

image

image

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Chrome

I believe it might be due to one of the environment variables (I have created accounts on each provider) but I can't find which one is causing the error?

Thanks!

PierrickLozach avatar Nov 15 '24 11:11 PierrickLozach

@PierrickLozach I believe I saw this error myself stemming from Prisma when the DATABASE_URL was invalid (or at least, couldn't access the database). Can you double check this field for me in apps/app/.env.local?

haydenbleasel avatar Nov 15 '24 17:11 haydenbleasel

Also experiencing this. DATABASE_URL is set, I can also open prisma studio and add new rows in the DB.

bogdansalau avatar Nov 15 '24 18:11 bogdansalau

Are you using neon as a database? By default the project is using neon.

By default, next-forge uses [Neon](https://neon.tech/) as its database provider and [Prisma](https://prisma.io/) as its ORM. However, you can easily switch to other providers if you’d prefer,

I was getting this error, but because I wasn't using neon but a postgres database from railway.

To solve this I changed the way the connection is made.

eduardodusik avatar Nov 15 '24 19:11 eduardodusik

Great point. @PierrickLozach what database provider are you using?

haydenbleasel avatar Nov 16 '24 10:11 haydenbleasel

This fixed my issue! Thanks!

bogdansalau avatar Nov 18 '24 08:11 bogdansalau

To solve this I changed the way the connection is made.

What changes did you make to the way your connection is made? I'm using a standard postgres URL like: postgres://postgres:[email protected]:5432/postgres but I'm getting this error still.

danhstevens avatar Nov 21 '24 19:11 danhstevens

@danhstevens I haven’t tested, but you may have to remove the neon serverless adapter from the database package.

haydenbleasel avatar Nov 21 '24 19:11 haydenbleasel

I just spun up a neon database and that took care of the issue.

danhstevens avatar Nov 21 '24 20:11 danhstevens

What changes did you make to the way your connection is made? I'm using a standard postgres URL like:

Just it:

env: DATABASE_URL="postgres://postgres:[email protected]:5432/postgres"

// packages > database > index.ts

import 'server-only';
import { PrismaClient } from '@prisma/client';

declare global {
  var cachedPrisma: PrismaClient | undefined;
}

export const database = new PrismaClient();

eduardodusik avatar Nov 21 '24 20:11 eduardodusik

Sorry about the delay. Did not receive notifications. The issue seems to be fixed on my side. I am using an AWS postgresql DB.

PierrickLozach avatar Nov 22 '24 16:11 PierrickLozach