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

How to Stream responses when using Langchain in the new route handlers

Im trying to build a ChatGPT app using langchain, but I cant figure out how to stream the responses to the client. This is how I have initialized openai with langchain ```ts import { ChatOpenAI } from "langchain/chat_models/openai";...

Local Deployoment

Hello everyone, new to the T3 stack. Am interested in using it for my company's internal intranet site. I would like to just deploy static files from NextJS to be hosted on my internal IIS server. It doesn't look like T3 is geared to that though and assumes deployment with Vercel and the like. Is what I want to do possible?

Disabled tRPC Query, default inputs

I have to wait for some data to exist before running the query. Typescript complains that I need to pass a string so I have to put a useless default in my query input (selectedBatch?._id || ""). Is there a better/cleaner way to do this? ``` api.bri.useQuery( selectedBatch?._id || "", {...

[CLIENT_FETCH_ERROR] when deploying to Vercel production

Hello, I am facing a problem when I am deploying my t3-app to Vercel in production. I am using Discord and Google Providers. I have set all env variables correctly. Locally everything is working, but when I deploy to production, I receive this error. Is it a problem with the next-auth package or I am missing something? url: https://omnifit.vercel.app/...

Unexpected token '??='

Had been using the create t3 app for few weeks playing around and today I was trying to share with a friend a quick example and failed just starting after the prisma db push. I was just starting the t3 stack first time with: npm run dev ...

Wordpress to React SEO Effect

Hello, I have a website that is running on wordpress but we started having issues on it and we were anyways have to revamp it. I was wondering shifting it to a different technology would effect the SEO?...

uploadthing bucket?

how can I create a directory / bucket for each user, so I can separate file uploaded by user. currently I used minio on my local, what I do is check bucket for that user, if it exists we putObject to that bucket, if it not exists we create a bucket first. Can we do the same on uploadthing?...

Extend or duplicate generate SSG helper functions?

Hello! In the T3 0 to prod video, Theo creates a function to generate an SSG helper. ```ts export const generateSSGHelper = () => createServerSideHelpers({ router: appRouter,...

Keep getting "NEXTAUTH_URL: [ 'String must contain at least 1 character(s)' ]"

I'm building a deployment workflow and I keep getting this error. The documentation states that setting this variable is unnecessary when deploying to Vercel, which is what I'm trying to do. Both setting and not setting the variable are things that I have tried. This is my 'env.mjs' file ``` import { z } from "zod";...

How to redirect using TRPC?

I am generating stripe checkout url from trpc endpoint and want to redirect user to that page. Here is what I am doing right now ```export const purchaseRouter = createTRPCRouter({ getUrl: publicProcedure .input(z.object({ text: z.string() }))...

TRCPClientError when creating an entry with blank `updatedAt`

Guys, this is my prisma schema: ``` model User { id Int @id @default(autoincrement()) firstName String?...

creating a type based on the input

```js export function getType(cols: Column[] | undefined){ if (!cols) return z.object({}); const schema = {}; cols.forEach((col) => {...

app crashing while using pm2 with prisma

While using pm2, it crashes with that message when creating a record. New to prisma, what I did wrong?...

SVGR doesn't display colors from my SVG

Hi, I have an svg file which I want to display on my website. The svg has a linearGradient but when I add it to my code and display it, I only see the svg black without the lineargradient which is defiend. ...

Can I use both raw and react tRPC client?

// Raw client const post = await trpc.post.byId.query({ id: "1" }) const addPost = await trpc.post.add.mutate({ title: "hello world" }) ...

Invalid Environment Variables In Brandnew Project

Just ran create-t3-app and just added one environment variable: Inside .env.mjs: ``` server: {...
Solution:
you need to add your new env var to runtimeEnv in env.mjs

request.query help needed.

Desperately needing some guidance with this, I've tried multiple implementations of this code with no success. I'm struggling to get the request.query to get the userId. Am i doing this correctly? Any help will be greatly appreciated 🙏🏼

How do i disable pre-rendering when using the app dir?

Building a tauri app using the app dir (for better or for worse). The app works fine but as soon as i run a prod build it fails due to next pre-rendering the page and thus hitting some tauri code that relies on the window

Clerk middleware + trpc

Hello, I don't understand why i can't use authMiddlewarefrom Clerck with TRPC. In the docs he say use withClerkMiddleware but you can't setup public / private route....

Server Side Rendering

This is from the tRPC documentation on server side rendering. Does anyone know where the createcontext come from in T3 design? I can't seem to find it. import { createServerSideHelpers } from '@trpc/react-query/server';...