Theo's Typesafe Cult

TTC

Theo's Typesafe Cult

Join the community to ask questions about Theo's Typesafe Cult and get answers from other members.

Join

TRPC: How to use different transformers

I followed the documentation on the https://trpc.io/docs/server/data-transformers page, but even after following the 4 steps I'm still getting the error: tRPC failed on <no-path>: Cannot stringify arbitrary non-POJOs, cause: DevalueError: Cannot stringify arbitrary non-POJOs Here's the code that probably generated that ...

Vitest, Clerk and TRPC integration

After adding Clerk to my application, my tests are encountering the following error: ``` ReferenceError: Request is not defined ❯ Object.<anonymous> node_modules/src/server/web/spec-extension/request.ts:10:34 ❯ Object.<anonymous> node_modules/next/server.js:2:16...

zod-prisma-types and prisma-zod-generator BOTH fail to generate

Just installed both zod-prisma-types and prisma-zod-generator ``` $ prisma db push ...

Vercel: An unexpected internal error occurred

Today I deploy T3 app to Vercel. I have tried deploying many times but the internal error message still appears. I don't know what the specific error is because of the internal error message ...

Backwards compatible deployments with trpc?

Throwing this in a thread to see if anyone’s got some opinions on this topic. Due to the zod validation in the trpc handlers, your frontend and backend deployments must always be in sync in order to avoid runtime errors. If you make a breaking change and somehow an outdated/stale bit of frontend code hits a newer deployment of the API, things will break. I feel like this possibility is not often discussed or even encountered as we tend to use trpc with next js and vercel. So coincidentally the frontend and backend deployments stay in sync....

next auth cypress test

Hi I have been trying to write an integration test using the next auth test documentation (witch are out dated), can some one please share he’s working solutions? By the was this is the guide I tried to follow: https://next-auth.js.org/tutorials/testing-with-cypress

Arguments for/against using AuthContext provider

In some beginner react tutorials I remember the need to set up AuthContext, specifically when rolling my own auth with mongodb. Im a little hazy but I would send user/pass to mongo, check hash and verify, then store returned user info into AuthContext with a dispatch. In all the t3 tutorial videos i do not see reference to using AuthContent. Could some more experienced devs chime in as to why I would or would not want to use AuthContext an react context api when building apps with T3?...

Invalid environment variables

I have following env var in my .env file: NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=xxx In my schema.mjs I have following:...

Does my DB schema look correct?

I am unsure if this diagram of my tables makes sense or if it could be improved in any way. Not the greatest at SQL. Thanks, just looking for any feedback!

Help with data-design for a personal note taking app for school (possibly using auth, idk)

I would like to make a personal note taking app using t3, in which I can keep my notes grouped per-class - full-text search, or maybe like a tag system where I have a field that is full-searched (would be formatted like statistics, creating a confidence interval or statistics, interpreting a confidence interval) - support complex math equations - support markdown or some other formatting for taking notes...

Is it just me or the search in the questions in discord is broken?

Is it just me or the search in the questions in discord is broken? It doesn't give me a single question for search and no matter what I do I get nothing

inferred type of appRouter cannot be named without a reference to server/node_modules/superjson

```web:build: ./node_modules/server/src/routes/_app.ts:4:14 web:build: Type error: The inferred type of 'appRouter' cannot be named without a reference to 'server/node_modules/superjson'. This is likely not portable. A type annotation is necessary. web:build: web:build: 2 | import { todoRouter } from './todo'; web:build: 3 |...

Creating multi language application

I would like to create an app that has english as the main language, but I want the user if he speaks Spanish to be able to switch through some button to a Spanish language version and go instead of / to /es and that to carry over to ever page. The question that I have is whenever I need to create a new directory in both components and in the /pages folder with /es route or what is the best way to go about it? Maybe there is already some tutorials and use cases on github of nextjs with multi language support? That would greatly help to understand how to deal with it....

Protected routes with middleware using the DB

Say I want to create a middleware function like authedProcedure called subscriberProcedure that checks if a user is a member of a team that has a paid subscription- simple trpc fetch of the users teamId to get that detail suffices. This works fine, but I am wondering if this is generally considered good/bad practice? Seems like the extra DB call for every single route is not ideal. I feel like this information could be stored in context session much like other user information is, but unlike the user id and other information, whether or not they are a member of a paid team is dynamic- it could change without the user actually doing anything (if say, an admin on the team changed the subscription). So where would be the appropriate place to fetch this value, and add it to the user session context? Or is my original approach fine....

Right way to install deps in a Monorepo?

i have a question regarding installing and managing dependencies in a monorepo. i currently have a repository with yarn workspaces enabled and turborepo. the workspaces are — client, server, ui. all these workspaces use typescript and few @types/~ as dev dependencies along with other packages. should i install the dev dependencies that are same in every workspace in the root of monorepo or in each workspace separately? what i want is a guide to installing deps the right way in a monorepo....

implementing search filter with nextjs and url params

anybody have any examples/docs on this matter?

Using Mantine instead of Tailwind gives useInsertionEffect Error

I created a new T3 App, I selected only tRPC, Prisma & NextAuth. I installed Mantine afterwards. I'm using Mantine Ring Progress and some other Components. But it is giving me error - error - useInsertionEffect only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/react-client-hook-in-server-component while runing npm run dev or npm run build && npm run start I'm not using the app directory. I asked the creator of Mantine, and I've used Mantine Default Template of Next.js, Everything was working as expected in that Template. Link: https://github.com/mantinedev/mantine-next-template Thanks...

Vercel responding with 503 (An error occurred with your deployment FUNCTION_INVOCATION_TIMEOUT)

I have created simple nextjs app using create t3 app. it has simple one router that returns a list of products. database is mongodb. It is working locally getting response from trpc router. but when i check my live vercel app it is returnnng 503 error. i have also integrate MongoDB Atlas to my vercel app....

Property 'authorId' does not exist on type 'Post[]'.

Coding along with the tutorial, and I came across this error I cant resolve. Portion in the video: 47:33 Code thus far: ```typescript...

Why .cjs?!

One quick question, is there a specific reason why t3 uses .cjs files? ( For tailwind and postcss )