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

Unauthorized 403 error

Failed to load resource: the server responded with a status of 403 (Forbidden): uploadthing-prod.s3.us-west-2.amazonaws.com/{file.key}. I tried changing uploadthing-prod.s3.us-west-2.amazonaws.com/ to utfs.io/f/ No avail. ...
No description

About Theo's take of not destructuring props

I can't remember in what video exactly, but I heard Theo saying something about using component props without destructuring them. I gave it a go but stumbled on some scenarios where I'm really scratching my head to know how to do properly without destructuring. Basically it's a matter of default values and prop forwarding 1. Default Values...

How to generate files and upload to Github?

I'm trying to generate files on my nextjs/vercel app and then upload to a new private repo on the user's github account. The user currently signs in using GitHub OAuth, how can I do this?

Zod, Non numeric string

How can i with zod enforce something to be a string and make sure it doesnt contain any numbers

Route workin in Dev and not Prod?

Hey guys I have a route defined (code below) that in dev works fine, I call it with PUT and it does just that fine. I am using latest NextJS 14 and am hosgting prod env in Vercel. In prod I get: ```js Request URL: https://xxxxxx/api/defendants?id=13 Request Method:...

Azure blob storage

Hello, I'm using T3 stack and want to send image (Buffer) to azure blob storage in back-end (await blockBlobClient.upload(...)). However, I get error: "Code": "MissingRequiredHeader", "Message": "An HTTP header that's mandatory for this request is not specified.\nRequestId:...", "HeaderName": "x-ms-blob-type" ...
Solution:
Update - managed to fix it. I had error before my file was in storage, thus blobHTTPHeaders was needed after the fix. I use yarn as package manager and with it installed Azure blob storage. Turns out, problem was with packages (modules). I don't know if it didn't install all packages, they were old version or something else, but I had to: 1) Delete node_modules folder 2) Delete yarn.lock file 3) Run all packages install again (few times)...

NextJS route.ts gets a 504 Gateway Timeout

Here is my code, I am basically fetching some data from mongodb and get this error. Everything works fine in my local build, but not while hosted on vercel. Here s my code...

do you query the localstore everytime to get the token before making api calls ?

Is it good practise to pick up token from localstoreage for every api call ? Context: im working with a very old legacy codebase which usses oidc client with react. There is no auth cookies, jwt token is stored directly into local storage. The issue: if the token expires lets say in 2 min. Oidc client makes calls to auth server for token renewal. And stores this token in the local store. But this change is not picked up the axios instance. It keeps using the old token....

Unexpected error in delete-image server action in Theo's modern react tutorial

So I was following Theo's react tutorial to build an image gallery, I'm facing an issue in the fullPageImgView modal, where, when the delete button is clicked ideally it should route to "/" path but for some reason it calls the getImage function which is only present in the fullPageImgView component which eventually returns the error I'm getting. in short fullPageImgView func is getting called again after deleteImage call resulting in getImage call fullPageImgView.tsx component ```javascript import { clerkClient } from "@clerk/nextjs/server";...
No description

Unable to upload files after deploying on vercel

This is how I implemented it but, does not seem to work as I get an error stating that no such file or directory '/vercel' ```ts const filename = fileURLToPath(import.meta.url); const dirname = path.join(__filename);;...

Backend Architecture - Programmatically generating files and pushing to user's GitHub

Hey guys, I figured this would be a good place to get some input on how to go about this... So right now, I have a NextJS/Typescript app set up with GitHub Auth. The user fills out a form that which then gives me a long command line string to generate some files (using yarn/npm) -- I have up to this point done now. What I'm wondering about is this next part though, I want to run this command somewhere (Separate Linux VM? Right there on Vercel?) to generate the files, and then I also want to upload them to a new private repository on their GitHub account. Not sure what the best way to do this is. For some context, this app is fully hosted on Vercel, but I'm not sure I'll be able to just npm/yarn install stuff and create/delete files on Vercel's server. I'm thinking......

New to the t3 stack and tRPC, how do I share code between route functions correctly?

Maybe I'm going about this the complete wrong way. Basically, as you can see below I am trying to create two different routes that share a lot of logic that I want to make into a function. I tried making a function outside of the discordRouter but I couldn't figure out how to type ctx correctly, so any thoughts would be appreciated. What I've tried so far is import { type createTRPCContext } from "~/server/api/trpc"; then type Context = ReturnType<typeof createTRPCContext>; but that's a promise for the context and I feel like I'm going about it the wrong way. ```ts import { createTRPCRouter, protectedProcedure } from "~/server/api/trpc"; ...

should we stop using useMemo and useCallback in react v19?

And is it safe to remove my old useMemo and useCallback?

Is there any React frameworks that fit my needs?

I've used NextJS at a few jobs before, and my least favorite thing about it is how impossible component-level data fetching w/ SSR is. I'm not a big fan of server components as a solution to this either, because then you are giving up the ability for the same component to be interactive. I've used Nuxt 3 a bunch and I love how nice SSR feels with it, how I can just useAsyncData (or any wrapper) anywhere and the server will just wait for them all to resolve before sending a serialized page. I also like how much control I get with Nuxt, how it exposes it's app instance with useNuxtApp and I can access it's internals how I want to create my own SSR behaviour. ...

TypeScript ORMs

So, I’m starting a new backend typescript project, and I’m wondering about which ORM I should use. I’ve used mongoose with mongodb before, which I very much didn’t like. I’d say I’m pretty experienced with TS and SQL individually....

nextjs14 app router support?

Dose the generated app will use the pages? Or the new nextjs app router?

Has anyone used t3stack to create telegram mini apps? How was your experience, which database?

Hey, if yes: 1. Does shadcn work in telegram? 2. Supabase? 3. trpc? ...

Makeing Chrome Extention For Review API Responsed Data

Hey 👋🏻 I'm here for a discussion about the chrome Extensions Earlier I made an basic extension. Can we fetch or view the data from our responced Data. After calling API. IT'S a user login platform.. ...

Auth.Js with t3 turbo stack

Whats the difference between the https://github.com/t3-oss/create-t3-turbo/blob/main/apps/auth-proxy/routes/r/%5B...auth%5D.ts and the https://github.com/t3-oss/create-t3-turbo/blob/main/packages/auth/src/config.ts file, did I need to have duplicated code for using a new authProvider? I tried to add credentialsProvider but did not get the sense why i need to add it twice.

Have to refresh typescript server after pnpm -ui add of components (TURBOREPO)

For some reason i have to refresh my typescript server after every component I add (otherwise squiggly lines) . Does anyone else have to do this?...