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

oAuth callback uri

Hi, so following a video I tried creating an app and deploying it to vercel with github login but I think I'm messing something with the env vars.. Adding pictures of my github OAuth settings and vercel env vars. What happens is that when I try to login, it redirects me to localhost:3000 with this error: "github?error=redirect_uri_mismatch&error_description=The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application." I wanna say that while my localhost is running everything is okay so maybe I missed something that I should have changed....

Vercel Deployment Invalid Env Variables

Hello, I've been trying to figure out why deploying to vercel is causing this issue during the build phase. Everything runs fine locally and I am not getting any errors building locally either. I have a .env with all my keys. I have deployed this project successfully before but after adding my AWS s3 bucket key, secret, region and bucket name, it fails at that part of the build. My env vars are in vercel as well and i have checked using the vercel cli. Any help would be great. It's driving me insane lol....

T3 API routes and GraphQL

We're building new React/Next front end code. We need to access our legacy Java business layer. In future we expect to build new business logic in Typescript accessing DB with Prisma. So we need a mix of T3/primsa and GraphQL (or OpenAPI / Rest). What is the best code architecture. I am thinking we create tRPC server side routes where we check authorisation etc. then call our GraphQL or access other databases via Prisma. Does this make sense, or this there a best way to mix?

Type of return from await

getting a TS error stating "34:9 Error: Unsafe assignment of an any value." on my await in getServerSideProps. Tried to scour the docs for a solution but can't find anywhere where someone sets a type that works for me await. getAudit is a JS function, not TS (yet). Any ideas on how I should best solve this? ``js export const getServerSideProps: GetServerSideProps = async (params) => { const audit= await getAudit(/granskninger/${params.query.slug}); // 34:9 Error: Unsafe assignment of an any` value. + 34:48 Error: Invalid type "string | string[] | undefined" of template literal expression. ...

electron + vite + react template?

does anyone have a template for electron vite and react without non-essenstial plugins.

[Help] Turbo shared types

I have a turborepo with two apps (web and embed). web is a t3 stack and embed is a create-react-app. I am trying to use the trpc endpoint from web to embed. I managed to make it work by configuring web's cors. However, I am getting type issues when importing AppRouter in the embed app. I don't think you can just import AppRouter from web like import type { AppRouter } from "../../../web/src/server/routers/_app"; which is currently what I am doing. So my question is how would I go about this? do I need to somehow share the types between the two? if so how would I do it?. Should I just seperate trpc as an internal package?...

Zustland Multiple stores

hey when using something like zustand, how would i use a store inside another store? for example i have metaDataStore which contains metadata, that i want to use in my readerStore metadata is getting used in a callback in the readerStore. The readerStore contains an event callback for onRead() so i cant really pass it into the function...

"The AWS Access Key Id you provided does not exist in our records."..but I have the right access key

Trying to use the S3 SDK. ```js export const s3 = new S3({ region: env.REGION,...

Build failed due to import error

Build failed due to import error After running the build command for my react app the build failed and the below is the response I get. ```Creating an optimized production build......

NextAuth auth flow causes Next.js 13 dev server to crash without throwing any errors

I'm building a note-taking app with ct3a (partly inspired by Jack Herrington's awesome T3 video) but I'm having a really weird issue with NextAuth where the auth flow succeeds, OAuth2 callback route is hit, but then for some reason the Next.js dev server crashes without throwing any errors whatsoever. I'm positive the auth flow is working properly because running NextAuth in debug mode shows a successful OAuth2 callback response with data - but it's still not throwing errors. Here's a slightly censored version of the console output from NextAuth: ```...

Customize QueryClient for TRPC?

👋 I’m using T3 for a project. Is it possible to pass a custom QueryClient to TRPC? I don’t like some of the defaults of react-query refetch logic and would like to set my preferences globally rather than per query...

NextAuth credentials how to handle unauthorized user?

I have this parent component which distinguishes if the user is logged in or not and redirect the user in the specific case. I signed in to my app and deleted all my storage and cookie data which would result me being unauthorized. But the redirect / condition does not work properly in this component: ```ts...

Anyone Have A Recommended Markdown Editor That They Use That Works With Next?

I was going to use react-md-editor (https://github.com/uiwjs/react-md-editor) however it seems that the only way to get this working with ssr is a lot of work arounds that I would rather avoid. Anyone have any recommendations?

WebSocket connection to 'ws://localhost:3001/' failed:

i have been trying to get websocet to work on t3 stack the past 6 hours but still unable to get it to work and yes i have had a look at examples-next-prisma-websockets-starter...

CRON jobs in the T3 stack

Hey everyone, I’ve got a project at work that is going to require the use of some CRON jobs. My background is primarily in Node, so I’m still learning the quirks of NextJS.
How would you go about implementing CRON jobs in NextJS? Is that even possible? ...

Aurora Serverless V2?

I’m currently looking into using this for a Postgres db and Prisma. Does anyone have experience with this? Would you recommend it? I’ve heard a lot of bad things about V1, but also heard V2 is way better.

Can you critique my idea/methodology for a Tailwind UI lib + semantic color system combo?

I am still a pretty entry level dev (~2 years experience), and this is my first UI library. While I think this is a pretty good idea, I don't think I have the experience to be confident about it, so I am hoping you guys can point out some blind spots / pitfalls with this approach. I've put up a docs site that goes into more detail https://www.chimera-ui.com/, but general idea is this: - Put a thin wrapper around radix primitives with a layer of default styling, and then allow users to overwrite that styling with tailwind. ...

Some Tailwind classes have no affect

I have a very weird occurrence where some elements have Tailwind classes apply css properties to them, and some don't. As you can see in the image provided, I have flex and margin classes, but they do not apply. It is true for all view sizes. On the contrary, an element above with width and padding classes, does actually have styles applied to it....

Types for an object passed as props

I run a map where I loop out content from a CMS ```js type PureContentProps = { content: {...

Typescript with array data from shitty CMS

I'm trying to learn this typescript thing Theo's banging on about all the time but can't figure out how to do TS with arrays. I get an array from my CMS that fits with the ContentProps I made ```js type ContentProps = {...