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

[TRPCClientError]: Invalid response or stream interrupted

Hi guys, I made an web app using https://create.t3.gg (holy moly I love this stack) and deployed to Vercel. The deployment works, everything is fine, the page is successfully rendered to the browser, until I recently found out on PageSpeed that my site is returning 500 error. I checked on the Vercel logs and it says there's an error on / path, with message: [TRPCClientError]: Invalid response or stream interrupted. For full error log please take a look on the attached image....
No description

Uploadthing, image is accessible even after deletion?

Hey, I am removing a file from uploadthing, i can see that the file is removed from the bucket but whenever I try to access it using the url, i can still access it. Is there some other thing that i need to do?...

504 Gateway Timeout Error on Vercel

Hello, everyone. I've been really bugged with this error as you've seen above. Anytime I try to host my full stack NextJS application which has MongoDB has it's database, I get that error. Please, how can I fix this?...

props with uploadthing

Hi, I need help with uploadthing, I've been looking for several hours for a way to pass a props (category) and then add this category with the image url in my database, I'm using exactly the basic configuration of the nextjs app router doc.
Solution:
if you set the input in your endpoint following the docs like this : ` import { z } from "zod"; f(["imageEndpoint"])...

redirection not working from root path "/" (react-router v6)

I am using react-router version ^6.25.1 , I want the user to be redirected to the home page /home if he logged in before i am using firebase-auth I check if the user is logged in via onAuthStateChanged observer provided by firebase if there is a user logged the promise is resolved if not it gets reject i am using a loader function to do this check if i call the loader function in my root "/" element the page keeps loading and I am not redirected however if i do that in other pages such as "/Logi...

How to test nextjs app against dockerized postgres container (Vercel)

I have a ct3a deployed to Vercel's free tier. I was wondering if it's possible to spin up a postgres container in Vercel's CI and run some tests before creating deployment previews/etc.

Next Auth Session

I want to use useSession() I want the callback to do a check on the url it is coming from (req.headers.host is ideal); however, I cannot access this information in the callback function. A possible solution I have explored is to go to /api/auth/[...nextauth].ts and override it from there however the problem with this is that whenever I am making trpc requests I have to also manually override that one which makes me repeat unnecessary code. I was just wondering if there is a better way to go about this. The part of the code I am referring to for the callbacks is the following:...

How to add metadata to file been uploaded?

im running app where users can upload files inside each orders, but i want to store the url in my own db, so i have to send order id when uploading so i can get it in my uploadthings route and upload it, i can do this on the after update property of the upload button but would like to know if there is a better way of handling this?

Using Dynamic Routes with Vercel Functions?

Seems like there should be a way to do this... For the route /api/events/init/[key] I have this code: ```typescript import { useParams } from 'next/navigation';...

t3 stack, making querries every time i reload the page?

Hi.. It's the first time when I'm using server components, and, decided to go with this stack. My question is, why do i have in console, a log with querry, everytime i reload the page? is it from the auth, and I was wondering, if shouldn't be a performance concerns.....
No description

How to structure layout.tsx with multiple providers/components you want to render

hello, currently i have a t3 app with trpc and I have multiple layouts clerk, chakra, and trpc. in my main root layout.tsx i also want to render a sidebar. I have tried multiple ways creating a help client-layout.tsx. the issue im getting is a "[cause]: SyntaxError: Unexpected token '<', "<!doctype "... is not valid JSON" in vercel logs im assuming because of how the layouts i have work. also this error only started showing up once i split up the two layouts when i went to integrate my sidebar.

DISCORD OAUTH Problem

OAUTH2, Discord Anyone ever run into this error? https://gist.github.com/barrybtw/8bb94fdcdbbee3d1a24e0e4c2c2f8fea I can run it locally just fine, but whenever I deploy it, I get this error in my logs...?...
Solution:
Figured it out, next takes in NEXTAUTH_URL as environment, defaults to localhost:3000

T3 Env Docker env variables not found

Do you need to use an env file with t3 env, as i am trying to run my next js app in a pipeline using docker. I have the env variable that i want to use in the pipeline enviroment but it is not in an env file. So each time i run it i get an error that the variable cannot be found. Does anyone have any suggestions and i can provide code if helps.
Solution:
there should be a skip check on the env

Embedable Scripts

Hey guys, I’m trying to make an embedable script that any website can use HTML script tag to embed. I want to make my script obviously looking very nice and even somehow inherit the ShadCN and styles. How would I do this? I’m unsure how to customize the style beyond standard HTML styling. Also, is this bad, with this slow down the website to have such complex components? This is for my next JS 14 application....

USing the latest t3turbo with prisma

Does anyone know how to solve this? I believe the error is coming from the middleware. Dont think prisma can work with the nextjs middleware an app directory.. Hola if you have any leads. Ty...
No description

API Patching Strategy

For patches on objects that update single fields, is it better to push each patch to its own route or have one route for all patches? Say you have a simple object ``` color...

Expose API endpoints to other apps

If I built an app with the t3 stack, how can I expose my api so other apps can use my auth logic or

Issue with T3turbo - Terminal Scroll to bottom and Not being able to select text

I have an issue with myt3turbo project. firstly the terminal does not automatically scroll to the bottom, meaning when i want to debug i have to manually do it everytime. Secondly, I am unable to copy paste any text from the terminal. ...

'Invalid response or stream interrupted' when using T3+TRPC with Clerk

Hello, I've encountered strange error when trying to use trpc's useSuspenseQuery while having clerk authentication implemented. When I try to call useSuspenseQuery, I get Invalid response or stream interrupted error. On client I get Uncaught Switched to client rendering because the server rendering errored. The full terminal output can be seen in this Github Gist. As I was putting together minimal reproducible example, I found out that this doesn't occur without Clerk. This led me to suspect it has something to do with Clerk's middleware, but I have no idea how to even start to debug this....

Loading server components on the client

Have anyone tried loading server components in the client. Maybe something like this: ```typescript <ServerComponentLoader ...