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

Vercel Lambda 405/413 error (large payload)

I have a api route which can potentially return a large amount of data back depending on who calls it, this occasionally leads to a 413/405 error: [ERROR] [1688280447665] LAMBDA_RUNTIME Failed to post handler success response. Http response code: 413. My route currently has ``` export const config = {...

My DaisyUI button is not firing onClick function

I was trying to make a button which add a product in my cart. But the button is sometimes firing the onClick or sometimes it doesn't I can't understand the exact reason Here's my code: ```jsx <button...

Easy way to add rate limiter into t3 stack / trpc?

Is there any recommended way to add a rate limiter into a t3 stack project / trpc?

env-nextjs not able to find .env variables

At least I think that's what's going on. Here's what I have in env.ts ``` import { createEnv } from '@t3-oss/env-nextjs'; import { z } from 'zod';...
Solution:
try with (its missing the CLERK) NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY,...

Deep react component typing

hey ts nerds, can someone help me out with this ? ```ts export namespace StyledButton { declare const SSpinner: import('styled-components').StyledComponent<Spinner, any, {}, never>; declare const SButton: import('styled-components').StyledComponent<'button', any, SButtonProps, never> & {...

Use Edge Runtime by default??

I want to experiment with a project that is using t3 stack + the Edge Runtime: (So far I've got create-t3-app + database.js + clerk deployed to vercel) In Theo's video on Edge Runtime he shows nextConfig.experimental.runtime: experimental-edge as a way of using Edge by default, and mentions it would likely soon be deprecated. That option is no longer in the type-defs, so I assume it indeed has been deprecated....

should i buy a mac ?

i thiking about buying, but sometimes i few its just luxury

Data grid

data grid recommendedation with pagination sorting and inline edit or delete im using react with useQuery for caching...

Conditionally excluding module from bundle

I am making a project using the same react native code base for both a mobile and web application. Stripe's react native SDK does not work on web at the moment. Does anyone know of a way to exclude that module when running on web using preferably the metro bundler? If you do not know of a way with the metro bundler do you know how to do this with alternatives?

Chirp: the trpc call to get all posts, hits the database every re-render....

Is this expected behavior? Or is the way Theo wrote placing the get all posts just as a demonstration, and that a real app would do something to get the data and only requery when it needs? Such as using useEffect to get it once and store it until change is needed? In the index.tsx he has: api.posts.getAll.useQuery(); ...

is infinite scroll with comments only possible with graphql?

that is, in nextjs with the app router, using nodes and edges.

How to access form data from before a user is authenticated?

So basically, I have a user fill out a form that is then stored in global state. Once they complete the form, they are instructed to login with google to 'complete' their account. I'd like to link this form data to their account somehow but I'm struggling with finding a way to pass this data through the actual authentication process. Has anyone ran into something similar and how did they get around it? Do I need to store the form data in a cookie or some sort of persisted state, or is there a way to pass data to the middleware and handle it there?...

Need advice on handling 10,000 images on Lambda

I need advice, I have a SQS that triggers lambda, it's an image processor that takes in 10,000 images and archives them in a zip file then uploads it to S3. I'm getting array buffer allocation on the archiving part. I might need more memory, currently has a max of 2560mb ram. This might be happening because I'm putting all the archived objects in a buffer instead of streaming, but it doesnt not work if i stream on lambda. ```ts...

Terms and conditions + privacy policy

Hey everyone, hope u are doing great, i wanted to ask about the terms and conditions of a website, is there an easy way to get them ? since i have no experience in law, it's a bit annoying.

How can I let users download files uploaded to UploadThing

Hey all. Total noob with anything to do with files in the web dev space. I adopted UploadThing in my ct3a project and was wondering if there was a way to make these files downloadable somehow. Currently, when the src link is pressed on an <Image /> or <a> tag, the uploaded image opens in another tab. Anyone know the best way to go about this? Thanks!

How to redirect when user ~is~ authenticated

So there's lots of documentation about protecting routes, and there's also ways within the useSession hook to perform an action if the user isn't authenticated. But is there a way to redirect if they ~are~ authenticated? I'd like to avoid doing something like: ` const { data: sessionData, status } = useSession({ required: true }) const router = useRouter() if (status === 'authenticated') {...

Metadata rarely updating when using <Link> to navigate

Hello all, I've run into this weird bug in NextJS 13.4 using the app router. For some reason when I use a <Link> to navigate to a page is refuses to use the correct title for that page. If I reload the page it shows the correct title. Now what has me really confused is that once in a while it does update for one page, but never changes after that. None of my pages are client side and I am using:...

Intercept request

Hi I wanna inject Authorization token in headers on every request. I'm very new to this stack and even to Javascript world also....

Create a global "reactive" variable

Hello everyone, I want to have a global variable which is available both on client side components as well as server side components. Is this possible? My variable stores translations. I want to avoid passing them down as props but I can't figure out a way to make them available in every component. It's important that the value gets initialized on the server, because I read the data by using the file system. Also I'd like to be able to change the variable and with it all components using the variable should get updated. ...