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 profile images broken

I'm using Spotify as a provider with NextAuth, and after a few months or so, the profile images break. The link to the profile image in my db returns a 404 as Spotify changes the url for the profile images for some reason. A few other providers have this issue as well. I remember seeing an issue in the NextAuth repo that provided some potential solutions you can do to solve this but I can't find it. Does anyone have any recommendations on how to fix this issue?

Zustand or Jotai for a Dashboard app ?

The doc of the t3 stack talks about Zustand and Jotai in its other recommendations : https://create.t3.gg/en/other-recs I am starting a project with the t3 stack (first time ^^) and it's my first time hearing about jotai and zustand. I am going to build a dashboard for data visualization, and there cannot be more than one route. I believe a state manager is great for this kind of app, but I see people saying to use jotai if the project is simple, and zustand if it is more complex. From your experience, when should you use these library ?...

[React Native] Open App Location Settings screen

Hey guys, I have been trying to Link users to the actual LOCATION/NOTIFICATION page of the settings in the OS and I can't find a way to do it. If I call the standard Linking.openSettings() I get to this screen:

Does Unit-Testing in T3 has been already discussed?

I've been searching in internet a lot to find some guidance with this, but haven't find much. There's any suggestion on what to go to? (I already tried Jest but had some trouble with the @t3-oss module, something related to ESModules)

How to use Prisma model type in tRPC mutation w/ Zod

I have some models defined in my schema.prisma file. Let's say they look like this: ``` model Art { id String @id @default(cuid()) // Some other fields...

Next-auth in a pure react app

As in the title, I've always owned my auth and made it using axios interceptors, I wanted to try next-auth in a pure vite react app. Is it possible to use it without api routes pure client side?

invalid env variables when deployed in vercel

Everything is working fine on my computer but not in deployment. Sorry I’m a noob in web dev 😅 Here’s my error:...

Experiencing hell while dealing with tRPC procedures and the "input needs to be an object"... help

``` import { TRPCError } from "@trpc/server"; import { z } from "zod"; import { env } from "~/env.mjs"; import { createTRPCRouter, publicProcedure } from "~/server/api/trpc";...
Solution:
hey @peterkyle01
In case anyone struggles with this in the future... I figured it out. It all lies on this line of code: const response = await axios.post($env.URL, input, axiosConfig) that needs to be await axios.post($env.URL, input, axiosConfig) without awaiting the response to assign it to a variable. If it is approached that way then it works just fine (idk why, just fixed the bug)....

What does "profile" function do in OAuth Adapter?

Can someone explain it?
Solution:
Can someone explain it?

Redirect next-auth signIn to history page

Hi guys i am facing a issue i have create a custom signin page and i am using credientials provider how to achive the redirect after signIn to the page it was opened before log in. like if i dont have a sigin page the default signpage of next-auth redirect to the perticulate page i have been redirected to the signin page how can i achive auth redirect after for more context i am using nextjs app dir...

Trying to start dev of julius acme-corp repo

I added env vars, ran pnpm install, ran npm i in every package and I still get this error: How do I make these imports work? What am I doing wrong? The way I'm trying to start it: 1. cd apps/nextjs 2. pnpm dev...

Does anyone know of a performant slider/carousel library for react?

We are currently using Keen Slider but it does not perform well. I'm hoping to find a performant slider library that can handle 200ish images. Any advice would be appricated....

How to implement redirect based on user role

Hi, I would love to implement redirections based on the user role. I want to implement it so that on every single page, I can explicitly define which roles are allowed to view the current page and the redirect url to which the user will be redirected if he isn't authorized to view the page. Now I have implemented a simple hook which works but the content of the page still flashes before the user gets redirected. What is the recommended way to protect routes in t3-app based on roles?
My implementation:...

Regex cutting off anything after space in the url

Heres the current regex : const regex = /(https?://\S+)\s\n\s(Canonical|\d)/g; it gives back: "http://www.stjosephnewwaverlytx.net/Religious" ...

dynamic routes in middleware with next-auth

so i want to do dynamic routes using next-auth with the config varibe that middleware offers This is what i have defined ```ts export { default } from "next-auth/middleware"...
Solution:
Ok ,then you can just expand on my example like so

Do we need a fetcher like SWR with the t3 stack

It isn't mention in the documentation so I was wondering, do we need a fetcher with tRPC ? It's my first time using this stack, but in my previous experiences, not using a fetcher became a nightmare. I don't want to send request I don't need to. So how does it work with this stack, what is the good practice ?...
Solution:
trpc already wraps around tanstack query, so you don't need swr with it

UploadThing with Python

I am using UploadThing on my main app where a user uploads a word document. I save it's UT URL in my DB. After it's submitted, I call a python API which runs some analysis on the document uploaded, creates a new document, uploads it and updates the DB. I looked through the documentations of UploadThing and couldn't find it, so I was wondering if there is any way to upload a document to UploadThing from Python?
Solution:
Right now there is not. We are currently working on a way to support server-side uploads which we plan to have out in the next week or two, at which point, you would be able to implement the same calls we are doing in the JS package in Python to accomplish this

Deployment error with working environment variable

I'm trying to deploy on vercel and i got this error below. I can call the OpenAI API (via server side/ api folder). And I've already filled up the env.mjs file. I did not edit the next.config.mjs as the t3 docs did not say anything about editing it. I've tried searching online and can't find any resource on it. (Fyi, my stack is t3 without trpc and nextauth. Also, I'm using pages router.) Do let me know if you need any more information. ...

Prisma not connecting to DB in amplify

Hey guys so i got the following schema ```ts model Images { id Int @id @default(autoincrement()) user User @relation(fields: [userId], references: [id])...