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

next auth vercel

Trying to deploy an app on vercel that use getServerSideProps, code seems to work fine on development but failing after deployment, doesn't seem to be finding the session i tried setting all the required ENV varaibles, could anyone assist?! ```export const getServerSideProps: GetServerSideProps<{ user: User }> = async (context) => {...

Interview Questions for Full-stack Devs

The context: my manager has asked me to help come up with some interview questions for pre-screening screening interviews for full stack developers. We are in a situation where we have to hire hundreds of people a year, across dozens of teams, and we are trying to improve and streamline the current process. The idea of the pre-screening interview is to build up a database of people and being able to "route" them to the correct hiring manager, instead of each manager having to manage their hiring process individually. So basically, I'm just looking for suggestions for interview questions within the following categories: 1. Soft Skills 2. Front End...

Server Side business rules validation

The context: I need to confirm a booking: So the user just pressed a button on the browser to confirm the booking Then I just need to update the booking status....

Following theo's Tutorial. After creating the private routes i'm getting this error

❌ tRPC failed on <no-path>: You need to use "authMiddleware" (or the deprecated "withClerkMiddleware") in your Next.js middleware file. You also need to make sure that your middleware matcher is configured correctly and matches this route or page. See https://clerk.com/docs/quickstarts/get-started-with-nextjs
❌ tRPC failed on <no-path>: You need to use "authMiddleware" (or the deprecated "withClerkMiddleware") in your Next.js middleware file. You also need to make sure that your middleware matcher is configured correctly and matches this route or page. See https://clerk.com/docs/quickstarts/get-started-with-nextjs
...
Solution:
https://discord.com/channels/966627436387266600/1106522494439018559/1106549069381369887 this response fixed it for me. Appparently my middleware has been in the root of my folder but should have been in src. I remember theo saying put it in src but i had used clerk before and i always put it in my folder directly so i just put it there....

fetching dynamic data in layout, not page

Hello hello. In my nextjs 13 project, my layout.tsx use a client side component (navbar) who also show either the user is connected or not (dynamic). By definition, the layout does NOT re render. ...

Prod and Dev rendering differently

For some reason one of the pages in my applications Taildwind CSS appears to not be applying when I do a Prod Build, but displays properly in Dev mode. (The image with the padding is displayed correctly in when running next dev) Issue only occurs on 1 page of the applications, in a server rendered portion. ...

Vercel KV watch, exec, etc. don't exist

Hey all, anyone have experience with transactions in Vercel KV? The docs (https://vercel.com/docs/storage/vercel-kv/redis-compatibility) seem to say that commands like watch & exec are supported, but maybe they're just referring to their CLI in the dashboard? Anyone know if there's a way to use the kv object with such commands? kv.multi exists so it seems like the others should too 🤔...

SQL vs NO-SQL

Hi guys. I often find my self working with database structures resembling document dbs. No relation other than nested data. Because of my familiarity with working things like prisma and sql in general and great services like supabase and planetscale I still host these in sql databases. Is there any advantage to switching to a no-sql database in such cases?

Stop react query from retry on 404

TLDR: I cannot get correct typing for the error, as the react query uses unknown type for the error in retry function. They also reccomend to perform a runtime check for the error. I'm kinda stuck as I don't lnow how to retrieve the error code from the error in retry function. --- Currently I'm trying to stop react query client (that's used by the tRPC internally) from retrying on 404 and 401 HTTP errors. I found this issue https://github.com/TanStack/query/discussions/372#discussioncomment-6023276 and adapted the answer to my needs: ```ts const MAX_QUERY_RETRIES = 4;...

Where to store pictures? Gallery Page

Hey, I did my first private project for someone which is a Gallery. I used vite to create it and used mainly typescript in there. Its now just a frontend application. I store all the pictures in the project itself which is now quite much and I would like to move the pictures somewhere else. My first thought would be to store it in S3 and then to the api call to like get in into the gallery. Unfortunately I don't know exactly how this should be done or even how to google it correctly. Do you know guys if there is like a documentation on how to achieve such things? Or will I need even a backend for it? I would really appreciate any guideline on how I could start on this....

Error when using clerk getAuth from UploadThing routes

Dear All, I'm having problem using clerk and uploadthing. NextJs: version 13.4.4 React:18.2.0 Uploadthing:5.2.1 Typescript:5.1.6...

Any bettter alternatives than sentry for error and perfomance tracking?

What are best alternatives for sentry for error and perfomance tracking in nextjs/T3 site? or sentry is the best for that?

S3 or google cloud storage ?

Hey, i am creating an ecommerce using nextjs, and i wanted to ask which one of the two services, s3 and google cloud storage should i use to store images of the website?

best way to do rate limiting for API Calls?

I have a web app that calls gpt's API to create a fun little fight story between 2 characters. Code and demo site are detailed at: https://github.com/JonathanAlphonso/ai-fight-pits...

Server Action. and Redux Thunk?

What is stopping me from creating a thunk that accepts a start transition as a parameter, That executes data on the server, then dispatches the result to the client. Well, an error is thrown when you take start transition as a parameter on a non-async outer function. ...

Different timings for animating to different states

I have a button, when I hover over it, it changes color over some amount of time, when I click/activate it it changes to a different color and I want that change to happen over a different amount of time than the hover change. How can I do that? className: "ease-in-out duration-500 hover:bg-red-800 ease-in-out duration-100 active:bg-red-900 outline-none text-white bg-red-600 font-bold text-lg border-4 border-black rounded-full bg-contain m-3 p-1" I'm aware putting 2 durations means that one simply overrides the other(and that 2 ease-in-outs is also redundant), I have them both here anyways to provide a better idea of what I'm hoping for...

Keeping vercel API routes synchronized

has anyone using vercel serverless functions figured out a good way to somehow keep axios/fetch calls to those endpoints in sync with the file paths? routes for the functions are based on filepath, so pages/api/my-route.ts resolves to URL/api/my-route...

next auth with custom backend

I have a nextjs web app. I have a backend that is managed as a separate server, repo, etc. The backend is where it checks for user role to change the responses, or prevent some users from using some routes etc. How should I go about connecting these two? I tried including credentials from the front end fetch requests but the backend won’t receive the next auth set cookies since they’re not set by the same server....

Migrate from nextjs supabase project to t3 stack

I recently discovered the t3 stack and made a project with it. I love it and I am wondering if it would be a great idea to migrate a current project using Nexjs, Supabase, Typescript and SWR to the T3 stack. However, this would takes some time for sure and there are a few question hanging around : - Does it mean I am loosing all my unit tests on my db (using pgtap) because prisma handle the schema ? - Do I have to replace these tests by something else ? - Do I lost all my RLS ? Is it safe ? Should I use another db maybe ?...

Next 13 middleware breaks page

Hi, Have some simple middleware ```ts export const config = { matcher: ["/((?!login).*)"]...