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

No response returning from api route

I'm making an api route to fetch/create a chatId for a chat room but its not returning any response, what is wrong here? ``` import type {NextRequest} from "next/server"; import {NextResponse} from "next/server";...

❌ Attempted to access a server-side environment variable on the client get's thrown in db.ts

Hi, I get a weird error in my nextjs application created with create-t3-app. It throws an error that a server-side environment variable get's accessed clientside in db.ts even tho db. should never be executed clientside. This is my env.mjs: ```typescript...
No description

Tailwind - Styles with same name but different value depending on the route

I am working on a monorepo. Each package in the monorepo counts has a route (e.g. the folder /page is the actual route that the users end up visiting with their browser) The thing is that a lot of components are shared and just change small things about the style, for example all components in /page with the style rounded should have a border-radius of 2px. But I would like all rounded classes in /page2 to have, for example, a border-radius of 4px. ...

FatalClientError - Cannot read properties of undefined (reading 'CUSTOM_INFRA_URL') using Remix

Hi, when I try to upload a file using UploadButton or UploadDropZone using Remix, the files are uploaded to uploadthing but I get the following error instead of the UploadComplete confirmation: Something went wrong. Please report this to UploadThing. at fatalClientError (useUploadThing.ts:37:3) at useUploadThing.ts:92:47
TypeError: Cannot read properties of undefined (reading 'CUSTOM_INFRA_URL')...

in the context of websockets is the UPGRADE request redundant now?

https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism#upgrading_to_a_websocket_connection i was interested in using the base web sockets and going through the motions of implementing this protocol but after reading more about it, it seems that it already occurs in the websocket api, so its not necessary to do myself? If I did want to do websockets from scratch, where would I start outside the websocket api?...

trying to use uploadthing with my custom useDropzone component?

is there any way to use upload ting with my own Dropzone component,instead of uploadthing components trying to have something like below const FileUpload = () => { ...

How would you guys implement user editable themes (next13 with Shadcn and tailwind)

Admins should be able to set a theme for end users by giving hex values for things like background colour etc. What would be the most elegant way to implement this?

Prisma and NextAuth: Additional fields in the `User` model

I have a system where users have to enter some additional information such username or birthday, NextAuth says that they should be defined as nullabe fields in the schema, but I don't want to, is there a way around this?

Shadcn-ui -> React Server Components

When scafolding a new t3 app and installing shadcn, should we say yes to Are you using React Server Components? I am specifically not using them, but not sure if this messes anything up in T3. Thanks!
Solution:
If you are not trying any experimental branches where app router is present, it should be alright to say "no" to the prompt.

ISR an RSC

is it possible to ISR an entire page.ts RSC in the app dir? i'm making some DB requests with drizzle inline and then rendering some html based on that. so far it seems like the only way to ISR this is to move the DB requests to a route.ts and use fetch with the right settings. Am I right about this or is there an easier way?
Solution:
Yes you can ISR a page. Just export revalidate. You can check build logs to confirm that it worked or not. Though some tools like Clerk or edge runtime prevents static generation.

Drizzle and Create-t3

I am facing difficulty setting up Drizzle (PlanetScale MySQL) within create-t3-app setup. Can someone please direct me towards a working code snippet or repo.
Solution:
I was able to solve this, adding "db:studio": "dotenv drizzle-kit studio" in package.json worked along with re installing mysql2 again. Thank you for your help @kershnerd happy

CreateTRPCNext<AppRouter> showing typescript error.

Hey all, I am having trouble setting up my tRPC
api.ts
api.ts
file. My current
api.ts
api.ts
file looks like this: ``` import type { AppRouter } from "@acme/api"; ...
No description

Drizzle FKey errror

I have a posts table in postgres and it has a parentPost Foreign key to allow posts inside post (something like twitter). Heres the schema. ``` export const posts = pgTable( "post",...

Prisma deleting wrong table?? WHY

Ok, here's what I want to do: I want to delete a EventMaster that is linked to a certain EventException. Here's my query: ```ts await ctx.prisma.eventMaster.deleteMany({ where: {...

Uploadthing limiting number of images uploaded

I know that we can limit it using maxFileCount but in my client components, I can keep uploading 8 files non stop and it wont be a problem. Is there a way that I can set that limit in UploadDropzone or other components so that I can limit the number of images user pick from their computer? I was thinking of implementing something like this but I am not sure which error to throw without crashing my app: ```onUploadError={(error: Error) => { toast.error('Something went wrong while uploading the image');...

What would you guys do if it were you?

Hey senior devs hahaha, would like to ask y'all how do you guys do this if it were you. As you guys can see there is like some png/svg behind the words. I was using absolute and relative (i'm not that good of a frontend guy 😂 ) to achieve this but wondering if there is a better way.
No description

Do multiple server actions resolve to one lambda call or is it multiple?

A few questions on server actions in Nextjs 1) Can I have a server action call another server action? I don't see why not. 2) If so, does that result in two lambda functions being invoked or does it just treat it as a function calling another function and in terms of lambdas, it just becomes one lambda instance? Which I think so... ...

Breaking Dev Content Creation Scene

tldr : hacakthon with cross comunity between dev creators ? aka <content creator > the super seo of his own community bossing people around . and the community are the dev team Lately Webdev Cody organized a hackathon and I had the pleasure of being a particiapnt in it .This gave me an idea How cross-community hackathon?fellow dev content creators become the leaders of their community . But here's the twist: the entire community becomes the development team for your project.It could be treated like a hackathong , tournaent or just a content generation machine....