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

Monorepo module resolution issue

Hi everyone, I'm facing an issue with a Next.js application in a pnpm monorepo workspace and would appreciate any help. It's probably just some config issue from my side, but I've been pulling my hair out over this the last few days! I have a monorepo using pnpm with two packages:...

Is storing flags/config as a single jsonb row in a postgres table a reasonable thing to do

I know there are better ways to implement this, but this one was the simplest to write a ui to edit them I'm just displaying formatted json in a monacco editor and parsing and storing it in that column. Aside from potential performance issues, which I don't think will affect us for a good while, are there any other downsides to this approach?...
No description

Nextjs: Reducing outbound bandwidth when google indexes all site URLs

I have noticed that when google indexes all 10k+ site URLs, the outbound bandwidth in fly.io goes very high (8gb+). As my site will continue to have thousands of more URLs as more users use the site, I am wondering how to get around this before I get a very large bill. For context, the project is using Supabase as backend....

Reducing edge invocations vercel/nextjs

It seems that when a route is running on the edge runtime, every visit to it is an edge invocation. Is this true? Got a very high traffic site which is going into huge overages due to a product page which is getting millions of visits a day. I've cached functions inside the page but I assume since the page itself isn't being cached it's counting towards edge invocations. I can't simply make it a static page since there are niche features which makes the page rely on multiple cookies (1 example is each customer has personalised product prices based on a unique customer cookie). Any solutions for reducing the invocations related to this page whilst keeping the cookie dependencies?...

Error while trying to upload video file

Ima having troubles trying to upload video files with sizes around +100mb. With version 6.13.2 O get a Retry error and in version 7.0.2 I get a this cors error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://sea1.ingest.uploadthing.com/6Fnf16reBVoHaY0M12KN6Q5wuLC2YUXvTViby7Ffj0nJH8Gl?expires=1728073825081&x-ut-identifier=es5j20zkec&x-ut-file-name=2024-08-16%252017-17-53.mp4&x-ut-file-size=238152949&x-ut-file-type=video%252Fmp4&x-ut-slug=lessonVideoUploader&x-ut-content-disposition=inline&signature=hmac-sha256%3D682c9f0f44a2e78c34e547aaf9f2d235e47f1d6ff7de29161567124e7ff7a018. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 504. This what I get with the debug logs in v 7.0.2 ```...

Restore mongodb data during Docker build

I want to restore mongodb data from my backup created using mongodump command . And i want to restore mongorestore it during build time so it can be used directly without further doing anything, There is a case , i successfully restore after container run but not able to restore data during build time. Is there any way you tried earlier .Really tired from this task 😣😣

nextjs refresh, trpc invalidate order

Does anyone know if order does matter and has any implication in case of trpc invalidation and router.refresh ? ```ts await apiUtils.invalidate(); router.push('/location');...

I can't figure out how to add "up to 10 developers"

I've scoured the site, closest thing is in the profile tab "add email" but I assume thats to add alternative emails for my own account and it doesn't seem to work for adding my devs. Maybe because they have their own accounts already?

Max Connection Issue with Supabase + Vercel

I am running into max connection issues when I am using supabase within an application hosted in a serverless environment (vercel). I've done everything I can find by the docs, but if I have a spike of 300+ users on my app at once, I start to run into a lot of max connection errors. I am using trpc to help batch request and limit connections made. I create the postgres connection outside of drizzle, set max connections to 3, and pass the instance in. ...

ESLint error in NextConfig when customizing webpack

When I try to extend webpack in NextConfig, ESLint doesn't like that the config parameter is any type. How can I get around this?
No description

Asking for Advice to Study/Understand the App Router

Hi everyone! Recently I've been trying to understand how the app router of t3 works under the hood and I've made a diagram of how things are connecting to each other. But I think I've hit a roadblock because some of the utilities used in this implementation are not even documented on tRPC website and seem to be very "bleeding edge". (e.g. createHydrationHelpers ) Do you think there's an easier way than diving into the tRPC/RQ source codes to understand how things are working here?! ...

Shadcn char color bar animation

Hi devs, pls let me know if you find out 🤔 which part of the code makes the color part to animate⚙️ in the chart : https://ui.shadcn.com/charts

tRPC mutation onError handler error type for shared logic

I have two mutations on my frontend that should handle the response in the same way. So I extract the onError function so these two mutations can re-use the logic but I have a problem on how to type the error so the in function handling is pleased with typescript and the onError handler is also pleased. ```ts // What type of the error should be here? const onApiError = (error: ???) => {...} ...

Latest t3 Template issues

Have to restart the TS server the whole time just to remove squigglies and having issues with imports. Brand new install. Just came off a very long t3 turbo project. Never had any of these sorts of problems. Are there any known issues with the latest template and windows?...

Quickly upload something without UploadButton/UploadDropzone

Hey everyone - I have an image that I want to upload directly into UploadThing. It's not the user inputting an image via button or dropzone but rather just me taking an image the user has already inputted, making it transparent, and then uploading that image into UploadThing. What would be the best way to accomplish this functionality? I was trying UT API but not too much luck with that...

Deployng Nextjs app on Windows Server 2019

Has anyone succed in doing it? I've tried everything and simply can't figure how to make it work.

Aws Sucks ( especially with cloudflare )

if anyone who has experience with cloudflare and aws SDk v3 , could you direct me in the right direction and lmk what am i doing wrong in this class : https://gist.github.com/kiritocode1/98a2da27d02df575abda23fe87ea30b2

Introducing new library to the deps

How do you guys introduce new libraries or package to be added in a project? More importantly convincing the team that this is going to be useful...

Open AI Billing me 3 Times for GPT Plus

Hey everyone! I just got charged 3 times for a GPT Plus subscription. Their support website is completely unable, any advice on how I would go about getting a refund?...