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

Next.js + tRPC + Redis - pub/sub

Hi, I have an app made in Next.js, and I want to get some real-time log feature for it. I thought about using Redis Pub/Sub to do it, and use tRPC Subscriptions also. Ideally I want to publish a message from Next.js API Route and then handle it in tRPC subscription. But for now, I'm trying to make the simplest solution and it doesn't work. I follow docs and made needed things to use it (one diff is I replace event emitter with redis) and when I published my message it doesn't seem to be handled in subscription. Here's the code, I will be glad, if you can take a look and tell me what I'm doing wrong. Thanks in advance! 🙂 https://github.com/Bartek532/rssmarkable/pull/40...

Invalidating a single part of a larger query

I am fetching data as such const postQuery = api.primaryRouter.getPosts.useQuery({}); and rendering as a list. I would like to invalidate JUST a single ID, this is possible via scenario #3 here https://trpc.io/docs/reactjs/usecontext#invalidating-across-whole-routers For example, if I later update one of the posts, I update then fetch just the updated post as follows - ...

Email verified boolean not changing firebase

im using the sendemailverification from firebase to check whether an email exist or not. Everything works fine but when i click on the link sent to the users email the Emailverified boolean does not change. Ive tried using the user.reload() but it dosent work

are there options when creating a app, to setup a login using email and password?

i know it says sign up, using discord…. but are there other options at creating the app, to include?...

tRPC cookies

Anyone know how to set a cookie with trpc?

Best way to redirect from create page back to index

Looking for some guidance around best practice to handle form create and redirects in one step. I often only see examples of create>invalidate on the same page but haven't come across many where there is a dedicated next page for the create form that redirects to another page. Currently, I have this setup something like this: ``` const router = useRouter();...

DayJS Relative Time bug - during T3 Stack Tutorial

This span is written the same way the tutorial is written. Imports have been imported:
import dayjs from "dayjs";
import relativeTime from "dayjs/plugin/relativeTime"`;
import dayjs from "dayjs";
import relativeTime from "dayjs/plugin/relativeTime"`;
...

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....