We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System: OS: Windows 10 10.0.19045 CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz Memory: 17.29 GB / 31.91 GB Binaries: Node: 18.17.1 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD npm: 9.4.1 - ~\AppData\Roaming\npm\npm.CMD pnpm: 8.6.12 - ~\AppData\Roaming\npm\pnpm.CMD
Using .keyof() function on any zod schema imported from the server causes
Error: ❌ Attempted to access a server-side environment variable on the client
It does generate the correct enum data though.
N/A -> Will Post if not reproducible
Use .keyof property on any zod schema imported from the server. Unsure if this will also cause errors on schemas created outside the server.
This is the full log of the error. Unhandled Runtime Error Error: ❌ Attempted to access a server-side environment variable on the client
Source p node_modules.pnpm@t3-oss+env-nextjs@0.3.1_typescript@5.0.4_zod@3.21.4\node_modules@t3-oss\env-nextjs\dist\index.mjs (1:456) Object.get node_modules.pnpm@t3-oss+env-nextjs@0.3.1_typescript@5.0.4_zod@3.21.4\node_modules@t3-oss\env-nextjs\dist\index.mjs (1:613) src\server\db.ts (12:6) @ env
10 | new PrismaClient({ 11 | log:
12 | env.NODE_ENV === "development" ? ["query", "error", "warn"] : ["error"], | ^ 13 | }); 14 | 15 | if (env.NODE_ENV !== "production") globalForPrisma.prisma = prisma; Call Stack ./src/server/db.ts file:///C:/Users/eden/Javascript%20Projects/idontknowwhattoeat/.next/static/chunks/pages/index.js (684:1) options.factory /_next/static/chunks/webpack.js (661:31) webpack_require file:///C:/Users/eden/Javascript%20Projects/idontknowwhattoeat/.next/static/chunks/webpack.js (37:33) fn /_next/static/chunks/webpack.js (316:21) eval webpack-internal:///./src/server/auth.ts (11:68) ./src/server/auth.ts file:///C:/Users/eden/Javascript%20Projects/idontknowwhattoeat/.next/static/chunks/pages/index.js (673:1) options.factory /_next/static/chunks/webpack.js (661:31) webpack_require file:///C:/Users/eden/Javascript%20Projects/idontknowwhattoeat/.next/static/chunks/webpack.js (37:33) fn /_next/static/chunks/webpack.js (316:21) eval webpack-internal:///./src/server/api/trpc.ts (11:70) ./src/server/api/trpc.ts file:///C:/Users/eden/Javascript%20Projects/idontknowwhattoeat/.next/static/chunks/pages/index.js (662:1) options.factory /_next/static/chunks/webpack.js (661:31) webpack_require file:///C:/Users/eden/Javascript%20Projects/idontknowwhattoeat/.next/static/chunks/webpack.js (37:33) fn /_next/static/chunks/webpack.js (316:21) eval webpack-internal:///./src/server/api/routers/restaurant.ts (7:74) ./src/server/api/routers/restaurant.ts file:///C:/Users/eden/Javascript%20Projects/idontknowwhattoeat/.next/static/chunks/pages/index.js (651:1) options.factory /_next/static/chunks/webpack.js (661:31) webpack_require file:///C:/Users/eden/Javascript%20Projects/idontknowwhattoeat/.next/static/chunks/webpack.js (37:33) fn /_next/static/chunks/webpack.js (316:21) eval webpack-internal:///./src/components/Card.tsx (10:88) ./src/components/Card.tsx file:///C:/Users/eden/Javascript%20Projects/idontknowwhattoeat/.next/static/chunks/pages/index.js (618:1) options.factory /_next/static/chunks/webpack.js (661:31) webpack_require file:///C:/Users/eden/Javascript%20Projects/idontknowwhattoeat/.next/static/chunks/webpack.js (37:33) fn /_next/static/chunks/webpack.js (316:21) eval webpack-internal:///./src/components/RestaurantTinder.tsx (7:63) ./src/components/RestaurantTinder.tsx file:///C:/Users/eden/Javascript%20Projects/idontknowwhattoeat/.next/static/chunks/pages/index.js (629:1) options.factory /_next/static/chunks/webpack.js (661:31) webpack_require file:///C:/Users/eden/Javascript%20Projects/idontknowwhattoeat/.next/static/chunks/webpack.js (37:33) fn /_next/static/chunks/webpack.js (316:21) eval webpack-internal:///./src/pages/index.tsx (9:86) ./src/pages/index.tsx file:///C:/Users/eden/Javascript%20Projects/idontknowwhattoeat/.next/static/chunks/pages/index.js (640:1) options.factory /_next/static/chunks/webpack.js (661:31) webpack_require file:///C:/Users/eden/Javascript%20Projects/idontknowwhattoeat/.next/static/chunks/webpack.js (37:33) fn /_next/static/chunks/webpack.js (316:21) eval node_modules.pnpm\next@13.4.2_react-dom@18.2.0_react@18.2.0\node_modules\next\dist\build\webpack\loaders\next-client-pages-loader.js?absolutePagePath=C%3A%5CUsers%5Ceden%5CJavascript%20Projects%5Cidontknowwhattoeat%5Csrc%5Cpages%5Cindex.tsx&page=%2F! (5:15) execute node_modules.pnpm\next@13.4.2_react-dom@18.2.0_react@18.2.0\node_modules\next\dist\client\route-loader.js (230:50)
The text was updated successfully, but these errors were encountered:
I don't understand the issue, what schema are you running .keyof on?
Sorry, something went wrong.
It is a custom schema that I made in serverside trpc code.
No branches or pull requests
Provide environment information
System:
OS: Windows 10 10.0.19045
CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
Memory: 17.29 GB / 31.91 GB
Binaries:
Node: 18.17.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 9.4.1 - ~\AppData\Roaming\npm\npm.CMD
pnpm: 8.6.12 - ~\AppData\Roaming\npm\pnpm.CMD
Describe the bug
Using .keyof() function on any zod schema imported from the server causes
Error: ❌ Attempted to access a server-side environment variable on the client
It does generate the correct enum data though.
Reproduction repo
N/A -> Will Post if not reproducible
To reproduce
Use .keyof property on any zod schema imported from the server.
Unsure if this will also cause errors on schemas created outside the server.
Additional information
This is the full log of the error.
Unhandled Runtime Error
Error: ❌ Attempted to access a server-side environment variable on the client
Source
p
node_modules.pnpm@t3-oss+env-nextjs@0.3.1_typescript@5.0.4_zod@3.21.4\node_modules@t3-oss\env-nextjs\dist\index.mjs (1:456)
Object.get
node_modules.pnpm@t3-oss+env-nextjs@0.3.1_typescript@5.0.4_zod@3.21.4\node_modules@t3-oss\env-nextjs\dist\index.mjs (1:613)
src\server\db.ts (12:6) @ env
10 | new PrismaClient({
11 | log:
The text was updated successfully, but these errors were encountered: