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

Uploadthing Error

I just added one column to my db in drizzle but now when i'm trying to upload anything on my development server, it's throwing an error. Can somebody help me out please?
No description

column userId doesn't exist

but I made sure my schema has it. I used drizzle btw.
No description

T 3 with app router

is nextjs app router supported by trpc with t3 if yes then how can we use it, provide example? since trpc doc directly says they don't support app router.

Do i really can or need to hide backend part in monolith app like T3?

Maybe its a noob question, maybe not so. I don't understand how we achieve the security of the backend and other authentication processes. The security I'm asking about involves hiding the entire backend from being understood. Am i worrying about nothing?...

import { api } from '~/utils/api';

So before I was able to import import { api } from '~/utils/api'; and do something like api.something.method.useMutation..... I now started a new project with T3 stack after a long time of not touching tRPC / Next.js and I am using app router and I can no longer use utils/api. What am I missing ? Thanks!

drizzzle + postgres error

I have generated a t3 application with bun, and I used postgres with drizzle. When I am running the bun run db:push command I get the error in the screenshot. Can someone explain to me why is that ?
No description

Null, Undefined, <form><input>, Zod validation and query result type mismatches.

I have a problem that seems complex to me, and can't figure out an elegant and scalable solution: I use Zod, Prisma, mySQL and React. I define my Zod schemas, that are 2-3 layers deep with .optional() properties in each layers. .optional() in zod translates to the undefined type in typescript....

Next14 + react-query + server actions: Deleting item from a table but the table should self-adjust

here's my deleteCategoryMutation ```ts const deleteCategoryMutation = useMutation<void, unknown, number>({ mutationFn: (id) => deleteCategory(id), onSuccess: async () => {...

Uploading zip/rar files

I'm trying to upload the zip/rar files, I already have the pdfs and images upload working but I can't upload the zip/rar files. Behavior: It lets me select the zip but nothing else happens....

react packages similar to jira tempo timesheets

any idea what packages i should use?
No description

upload only pdf and word

Hi, how can I enable uploading only documents e.g pdfs, word and maybe excel? Currently I have only pdf specified but it appears that this does not allow for word and excel. Many thanks in advance.

Next.js file organization and security with data access

Does anyone have time to check out a project I'm currently working on and share their insight on file organization and security with data access? https://github.com/Raphico/byte...

How to upload file from local path using the utapi uploadFiles or uploadFilesFromURL

I'm trying to upload files from disk without setting up and endpoint or getting from the client but when I use the utapi functions, they do not work directly with the file path or the buffer gotten with fs.readFile(path). How do I transform the file so I would be able to upload using either utapi.uploadFiles(files) or utapi.uploadFilesFromURL('/file_path')...

[email protected] "do not use"?

Hi! I just set up a new T3 project. Installing the packages generated the following scary message:
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it.
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it.
The message further recommends using lru-cache instead. Will replacing inflight with lru-cache break my project? Or should I just stick with inflight and hope for the best?...

TypeError: Cannot read properties of undefined (reading 'url')

Hi, I'm getting this error when I try to upload an image: ``` (FiberFailure) TypeError: Cannot read properties of undefined (reading 'url') at eval (webpack-internal:///(rsc)/./node_modules/uploadthing/server/index.js:492:33) POST /api/uploadthing?actionType=upload&slug=productImage 500 in 608ms...
Solution:
Solution: I was using MillionLint and apparently they're incompatible (or I didn't have the correct config), so removing it fixed the problem

How to manage external ids in my database

I'm storing Facebook ads in my database and I'm struggling to figure out whether to use external ids or internal ids. Relevant Stack: Using postgres, drizzle-orm, supabase Background: A facebook ad breaks down into several components: Facebook page, adCreative, ad, locations, ...

How to revalidate the data cache on deployment

I'm building my SSG website with Sanity headless cms and have set up webhook to trigger a redeployment on new content being published so it would generate a new pages with updated content. The problem: When I leave the fetch request by default, the data is cached across deployments so it would use the data from the last deployment instead of the newly updated data. So I added cache: no-store to the fetch option but that made it so that the page become dynamic and would fetch the new data before it's ready for production and erroring out, moreover I'd like the pages to be SSG so that's wouldn't help. What I've tried: I've been crawling through this guide https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config but most of it just essentially impose 1 caching strategy on every fetch request on a layout or page...

Using table prefixes in drizzle multi-project schema with NextAuth.

I'm using a setup that allows for schemas of different projects in one database, the default drizzle setup with T3. Using ``` "@auth/drizzle-adapter": "^1.1.0",...
Solution:
totally my bad, it's covered in https://authjs.dev/getting-started/adapters/drizzle if anyone has this issue in the future. just needed to pass the tables object with the correct assignments.

Client side Upload button disabling

one more question. In my form, i need "selectedCategory" to be selected. It is a useState which is either undefined or has a category value. Is there a way I can disable the upload button if that state variable is undefined (user must have category selected)? Thanks! I did this in core.ts if(selectedCategory === "") throw new UploadThingError("Need a category to be selected") But can i do this client-side too?...