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 return stream

Hey, I'm generating pdf doc then converting it to stream and i want to return it from my endpoint, but trpc i yelling at me with this error
TRPCClientError: Unable to transform response from server
TRPCClientError: Unable to transform response from server
trpc doesn't allow to return streams? I wasn't able to find anything to clarify this in their docs or google....

Workflow with Planetscale

Hi Guys! I'm just curious what's your usual workflow when working with planetscale and you have schema changes? Because all the data will be lost after db push command. Does this not affect your development? Or do we have some best practices and tips? Thank you! Btw do you just seed data needed for the app to work?...

T3-Turbos file-structure lacks app-folder in Expo

From the README-file I can see that T3-turbo utilize the Expo Router navigation. However, in the Expo Router-docs, I’m being told that all routing must be defined within the app folder. Looking at the T3-turbo structure. I dont see routes. Instead I see named exported components in a folder called screens. What’s the approach here?...

Prisma + Zod.. which types to use as SOT? Is there a better way?

I’m building t3 app with prisma. Since I want to use trpc and react hook form, i feel like i also need zod. But now I have a dilemma of needing to pick a source of truth for my types. I’m assuming I should use prisma since its ultimately the db. I’ve looked at some libraries to generate zod schemas from prisma, but it just doesn’t feel like the cleanest way to go about this. How have you all handled this in the past?

S3 with TRPC

can somebody give me repo or tutorial how to use s3 with trpc ? (never used aws before)

Build Error due to React-konva in NextJs

So, I was creating a web app using Konva in Next.js, and I know Konva needs JavaScript to draw. So, I disabled SSR for it, and it is working correctly in development mode. However, when I build the app, it shows an error.

How to use webhook with tRPC?

What endpoint should I set for the webhook? https://example.app/api/trpc/example ? And how would I receive the req from the tRPC router? More specifically, I'm trying to use Clerk's webhook....
Solution:
my advise don’t use tRPC for this use a separate api endpoint e.g /api/webhook. Otherwise if you really want to, create a router call webhooks, procedure called user. then it would be /api/trpc/webhooks.user...

Replace fetch with trpc useQuery

```tsx async function load({ signal }: { signal: AbortSignal }) { const res = await fetch("https://swapi.py4e.com/api/people/?search", { signal, });...

Stop unnecessary vercel deployments in mono-repo

I have one repo which contains two vercel projects, with both projects linked to the same git branch. At the moment, if I make a change to one project, it triggers a redeployment of both. Is there a way (perhaps with GitHub actions) to only trigger builds for projects when certain sub directories have changed? Thanks!...

Basic Data Flow For tRPC, Prisma, and an External API based on NextAuth data

I want to display a list of objects from a database based on the current user (already done) Once the user selects the object, how should I go about fetching more data such as detailed information on that selection? How should I properly set up fetching so that I never get stale data and the UI is in sync? I also would like to use a mutation for submitting a form, anything special I should keep in mind?...

Auth Astro package

Not directly a question I guess, but has anyone used the Auth Astro package? It's supposed to be a wrapper for Auth.js (NextAuth). I'm trying to get it to use a database via an adapter but it does not want to work for me no matter what I try. Any input would be appreciated.

React query and image gallery ui

What would be the recommended action for RQ to update an image gallery UI (think instagram search page, a grid system basically). Let's say the client searches for the latest images and then display the most recent 10. And let's say every second we have 2 new images. Whenever RQ fetches new data, the whole grid gets rerendered. While the data are kept in sync, it doesn't feel like a great user experience. What are some alternatives here?

Zod optional fields and numbers

I'm following along with the T3 app video made a few weeks ago (the twitter clone one), but adjusting it for an app I'm making. I'm currently creating a page that sets up Organizations (teams), but I can't figure out how to resolve this issue (I've watched a handful of Zod, tRPC, and Typescript videos and read through some other threads to try and find an answer, but I haven't found anything to solve this yet). Here is my current schema: ```orgId: z.number().min(1).max(191),...

useSession returns unauthorized

I am using the standard t3 stack setup with NextAuth - session provider wrapped around it all. My middleware is set to protect all pages (default export). When i log in with credentials, and try to use useSession from my Component, i get status:unauthorized. In addition: The first initial page of my app loads, since i just authorized but when navigating to any other page, i have to auth again....

Backend Technology Advice

Hello, I'm a newbie React developer and i need to learn some backend to use in my projects (like create a simple e-commerce database etc.). What should I learn as a backend technology ? What is your advice?

Extending Error SWR

Does anyone know how to extend error type to make something like this example from SWR work? https://swr.vercel.app/docs/error-handling#status-code-and-error-object Very lost on how to do this after looking online for awhile. thx!...

verify thought process: TS and python serverless functions

im making the backend for a chrome extension that downloads the mp4 audio file from a youtube video and runs it through the whisper api from openai i have a job queue table in my DB that tracks the status of jobs that are queued for 1. downloading audio from YT or 2. running audio through whisper i have a supabase edge function (deno so only TS is supported) that will download audio and save to supabase storage...

Weird bug? Can't import {PrismaClient} from @prisma/client

The problem is only with typescript I guess, because the code I wrote works perfectly. pic 1 - my schema pic 2 - db.ts pic 3 - api/hello.ts ...
Solution:
I updated my IDE(PyCharm - same thing as webstorm but with python support) from 2022.2 to 2023.1, and the bug is no more present

Is expo trpc supposed to work without nextjs?

I have a fresh copy of create-t3-turbo. When launching expo only I can get it to load but it is not displaying posts. When i run general dev command which launches nextjs + expo, posts load on expo. Is this supposed to happen or is expo trpc supposed to work without nextjs running? If this is correct behavior how does it work in production if your website goes offline?...
Solution:
trpc "extends" nextjs api routes and works just like a simple REST server in this aspect. if you don't run the nextjs app, no server will be running, so the expo client wont have anything to connect to. ideally in production your website wont go offline, otherwise the api will not work.

Async set state

You are looking at the logic behind my search functionality. The highlighted part of my code is not working the way its supposed to. Every time there is a new search I would like to empty out my playlist array and assign it to the new results returned from the server. Currently the new results are being appended to the older results. ...