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

NextAuth dangerous website on email login

I keep getting dangerous website on chrome when I click on the url in the login email from email provider. I believe its caused by secure: false from my nodemailer options. I am using outlook's smtp with port 587 and need to turn off secure false and enable tls instead. Any workarounds?...

Issue installing a dependecy

I've been trying to run Mozilla bedrock locally using the "Make clean run" command as mentioned in their docs but it seems to be stuck at 1 file forever

t3 turbo boilerplate for existing t3 app: next.js, clerk, trpc, prisma...

Looking for a boiler plate code base to convert my t3 app that uses clerk into a turbo mono repo. I want t add other apps such as a fire base cron jobs.
Or a good tutorial on how I can do this on my own.
I saw this one https://github.com/clerkinc/t3-turbo-and-clerk. But doesn't seem active? ...

working with datetime in drizzle

Problem:- I don’t know what date time is working in drizzle
Drizzle schema export const reminders = mysqlTable(...

Routing and deployment in site builders

Hi, I wanted to try building a website builder kinda like squarespace or wix with next, wanted to know about the routing part, like how do they assign and connect subdomains like xyz.wixsite.com or the ability to connect a custom domain like xyz.com and how does the deployment work? is it a single next app, hosting all the websites or they are all seperate websites hosted in something like a docker container? Any help would be appreciated... Thanks :D

Check if unique key exists before create

I'm using react-hook-form with zod validation, and I want to check if a unique key exists on the onBlur field event. I can't put it inside Zod validation nor can I rely on the server to respond with this error after submission, because planet-scale never knows what column caused the error. My workaround was to create a trpc route to check if the key exists, call a it's refetch every onBlur event and conditionally use setError to invalidate the field. But this approach is cumbersome and doesn't seem like a good solution....

How to upload files from server side?

I am using nextjs 13. Lets take this example: User upload a video -> video uploaded to UT -> i download back the video on server to modify it (with ffmpeg for example) -> need to upload the new video to UT from server....

Call TRPC from an api

How can I call TRPC from my api backend?

Testing and Debugging Next.js13 apps for production

Just curious how testing works for Next.js13 apps, read a little bit on jest but need more insight on production based development... Is testing necessary on all applications and what is the best way to go about testing application and also debugging

how does vercel take screenshot?

Basically, how can I do something like this in my site?

Google sheets API and restricting scopes

Is it possible to somehow restrict API use to only creation/updating of google sheets? I'm currently referencing this (https://developers.google.com/identity/protocols/oauth2/scopes#sheets) and it seems like the only options are either readonly, or full control of files, it'd be nice to be able to specify more granular control/limits to the file manipulation....

TRPC server side prefetching not working properly

I have tried to fix this bug for a while now and I literally do not know what to search for anymore. I don't know if it is a bug with the T3 stack as a whole or just TRPC. On my user profiles I have a createdAt field which is supposed to be a datetime field. I want to prefetch this in my user profile page. import superjson from "superjson"; ...

POST API endpoint only working if request made from POSTMAN

I am developing an app which needs to send information to an endpoint another client has put online to receive POST requests. This is just a simple POST request I send with a body, then the client saves its body to wherever he wants to. This endpoint has no Authorization header as it has been removed recently due to thinking it might be the cause for it not to work. So, now, it only works if you do the request from Postman. I created a simple Expressjs server and deployed on Vercel to mock that client endpoint for testing purposes (just returns the req.body to the client) I deployed my main project on Vercel and made POST requests to my mock Express app. Works. I deployed my main project on AWS Amplify and made POST requests to my mock Express app. Works....

prefetchInfinite not working when inputs are different from useInfinite

Ive been trying to figure out why prefetching doesnt work when the inputs are different between prefetchinfinite and infinitequery. Its works great when the inputs are the same. Hoping someone can shed some light on this. ``` export const getStaticProps: GetStaticProps< PageProps,...

Serverside Caching with Next API Routes

Is anyone super familiar with how fetch with next revalidate on api routes works? I know Next API uses lambdas, so I'm curious how data is cached. I'm assuming it is somewhere in Vercel's dbs, but just wanted to see if anyone knew for sure.

[Next.js App Router] Dynamic segment 404 on Vercel, but not local production build

Hello! I've been facing an issue on a production/preview Vercel instance of my app. On build, I have generateStaticParams to generate my routes at build time. The expected behavior though is that the routes are to be dynamically generated for future changes with data (i.e. a new date being returned from getDailyTitleDates()) ```ts...

Rewriting all mongodb queries ?

I am using the t3 stack to create a dashboard on an existing project. The data comes from mongodb and there are already a lot of aggregation pipeline written for python. But using prisma with mongodb, I cannot use these pipelines because the groupby for instance is incompatible with aggregates. I need to use groupBy() from prisma. Does this imply I have to rewritte all the queries only for that project ? (because only prisma use that) If there is no way to use the normal aggregation pipelines of mongodb with prisma, can someon explain me why did they make it like that ?...

how do I get the types from data off of a use query???

const { data, isLoading: isGetListDataLoading } = api.list.getLists.useQuery() im using this code in a context provider and I want to pass this data down but I can't cause typescript....
Solution:
src/utils/api.ts should export the type RouterOutputs

Prisma not creating entries in the given order

I have the following trpc prisma code given below. When "module" have the optional "image" field filled it will be created after all the empty ones even though the request has them in an array where they are ordered. Any idea on how to fix it? Sorry for the long code Output: Got modules as: [ '<p>1</p>', '<p>2</p>', '<p>3</p>', '<p>4</p>' ] Created modules as: [ '<p>2</p>', '<p>3</p>', '<p>4</p>', '<p>1</p>' ]...

can't get to work NativeWind for Expo Mobile and Web

Hi, I've been trying the whole day to achieve this. I've installed NativeWind, followed the guide (https://www.nativewind.dev/quick-starts/expo) and it worked for mobile but not for web. So, after playing a while with webpack and postcss, I managed to get it work, but then it stopped working for mobile. ```jsx...