t3-oss / create-t3-app

The best way to start a full-stack, typesafe Next.js app
https://create.t3.gg
MIT License
25.66k stars 1.19k forks source link

bug: broken tRPC error with latest t3 app and Auth5/googleProvider #2027

Open electroheadfx opened 1 week ago

electroheadfx commented 1 week ago

Provide environment information

"ct3aMetadata": { "initVersion": "7.38.1" },

Describe the bug

I install the t3-app with default based on this setup

What will your project be called?
rwai-auth-t3-latest-7.38.1

- Typescript    yes
- Tailwind      yes
- tRPC          yes
- NextAuth      yes
- ORM           Drizzle
- App router    No
- Database      Postgres
- init Git      No
- pnpm install  yes
- git setup     no
- alias         ~/

I do the change with googleProvider with the good postgres DB etc ...

When I pnpm run dev: I got error on trpc:

 GET /api/trpc/post.hello?batch=1&input=%7B%220%22%3A%7B%22json%22%3A%7B%22text%22%3A%22from%20tRPC%22%7D%7D%7D 500 in 30ms
 ⨯ Error: Failed to load external module next-auth: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '~/rwai-auth-t3-latest-7.38.1/node_modules/.pnpm/next-auth@5.0.0-beta.25_next@15.0.3_react-dom@18.3.1_react@18.3.1__react@18.3.1__react@18.3.1/node_modules/next/server' imported from /Volumes/T7/work/railwai/Dev/labs/rwai-auth-t3-latest-7.38.1/node_modules/.pnpm/next-auth@5.0.0-beta.25_next@15.0.3_react-dom@18.3.1_react@18.3.1__react@18.3.1__react@18.3.1/node_modules/next-auth/lib/env.js
Did you mean to import next@15.0.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/server.js?
    at externalImport (/Volumes/T7/work/railwai/Dev/labs/rwai-auth-t3-latest-7.38.1/.next/server/chunks/[turbopack]_runtime.js:352:15)
    at async (

with in screen: Loading tRPC query...

I can log In and log Out fine with google but trpc is broken

Reproduction repo

http

To reproduce

I setup for google provider so I do:

# Generated by create-t3-app.
AUTH_SECRET="xxxxxxxxx"

AUTH_GOOGLE_ID="xxxxxxx"
AUTH_GOOGLE_SECRET="xxxxxxxxx"

DATABASE_URL="postgresql://postgres:password@localhost:5432/app"
export const env = createEnv({
    server: {
        ...
        AUTH_GOOGLE_ID: z.string(),
        AUTH_GOOGLE_SECRET: z.string(),
        ...
    },
    runtimeEnv: {
        ...
        AUTH_GOOGLE_ID: process.env.AUTH_GOOGLE_ID,
        AUTH_GOOGLE_SECRET: process.env.AUTH_GOOGLE_SECRET,
        ...
    }
})

export const authConfig = { providers: [ GoogleProvider }

Additional information

System: OS: macOS 15.1.1 CPU: (16) arm64 Apple M3 Max Memory: 15.26 GB / 64.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node npm: 9.8.1 - ~/.nvm/versions/node/v18.18.2/bin/npm pnpm: 9.12.2 - /opt/homebrew/bin/pnpm bun: 1.1.8 - /opt/homebrew/bin/bun

electroheadfx commented 1 week ago

Run fine with T3 version 7.37.0 (Auth 4)