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

any tips for implementing Google maps, open layers, or open maps?

I've unsuccessfully tried to add a map to a page. Does anyone have a good example?

Should I look into using linked lists?

Hey guys I have a data structures question kinda. I am building an offline electron app that's using SQLite as the database. I am going to have 3 tables in my database. Each of these tables will hold 1000 items each at max. right now as things are I'm just fetching all the items and storing them in a typical array and printing them in a table. I'm working with TypeScript. My question is that should I look into implementing linked lists for speed and such? Sorry if this is a stupid question or if it doesn't make sense. I'm going to be learning linked lists and data structures in general soon so not fully sure of the advantages and such just yet....

[next 12] Stripe webhook doesn't work

Hey, I'm using the Taxonomy stripe webhook file as an example for my next 12 project that is deployed on vercel, and whenever I trigger a webhook, it fails with the following error: "Webhook Error: No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe? " This is the Texonomy file i'm using: https://github.com/shadcn/taxonomy/blob/main/pages/api/webhooks/stripe.ts...
Solution:
Api secret key and webhook secret are not the same thing

Get IP of user using trpc?

is it possible to just get the ip of the user using trpc without just including it in the input?
Solution:
req.headers['x-forwarded-for']

NextAuth add additional property to session

Hi, I am trying to add "plan" to the session object that I can receive with the useSession() hook. I am using create-t3-app ```...
Solution:
```ts import NextAuth from "next-auth" declare module "next-auth" { /**...

What is the difference between procedures and middlewares in TRPC?

Hello! I was wondering what is the difference between procedures and middleware in TRPC. I know that procedures are used to build context and such but could you not also essentially do what is done in a middleware inside the procedure itself? Thanks!...

Mapped Types Not Inferring From Promise Correctly

TS mapped types not behaving as expected on promise inference Desired DX ```ts...

Webhooks (localhost) in Clerk fails for the most part

I’m not quite sure I understand the subject (Webhooks) in particular. Currently I am running a localTunnel instance and’ve put the URL into clerks Webhook-endpoint. Sometimes when I run the example (Testing), my Webhook code is being executed and does what its supposed to (user.created). But if I like try to run the example again, it always fail. Does anyone know the reason for this? Receiving a Timeout-status code. If I also remove my user from the User-table in Clerk and re-login in to my application. The Webhook is never executed....

Protect all of the app so user HAS to be logged in

What would I need to do I make it so the app is protected and all of the routes (except for the auth stuff) are protected as in user needs to be logged in? also when I tried the middleware.ts file it didn't seem to work

NextAuth "[next-auth][error][JWT_SESSION_ERROR]" (CredentialsProvider)

This is my first time using next-auth, and I am trying to get basic credentials-based authentication implemenmted. ``ts /** * Module augmentation for next-auth types. Allows us to add custom properties to the session`...

NextAuth Google Auth provided value for column is too long

``Invalid prisma.account.create()` invocation: The provided value for the column is too long for the column's type. Column: for [next-auth][error][adapter_error_linkAccount] ...

clerk how to implement user roles

What is the best way to implement user roles (let’s say admin and user) and authorization based on them (to keep it simple let’s say admin can change anyone’s role while user can’t change anything)?

Uncaught TypeError: Om is not a function

I built a react app with vite and everything works fine in the dev server, but when I build it I get a blank white page and the console contains the error:
Uncaught TypeError: Om is not a function
Uncaught TypeError: Om is not a function
I looked where it was pointing to in the code and seems to be upset at this: ```ts h.useState(Om(Date.now()))...

<Select onChange()>

Does someone knows how I can apply onChange on a Select element? (shadcn ui) https://paste.pythondiscord.com/akujoqupuk...
Solution:
Shadcn ui is just a wrapper around Radix UI. Correct prop is onValueChange. See https://www.radix-ui.com/docs/primitives/components/select

Trouble with async validation using React Hook Form

I have a form in my app where a user can enter info for a song. One of the fields is for the spotify url of the song. I made a trpc procedure to get the track info from the spotify url. So if the user pastes the spotify url in the form, it will trigger my query to load the track info, and then I autofill the other form values with the loaded track info. If the query fails, I want the spotify url field to show an error message. I tried to do this by calling setError when the the query errors, b...

Connect Prisma to AWS RDS Database (PostgreSQL)

first time i'm trying to connect my prisma to AWS database, I'm using RDS and postgresql as database so I think I input my database connection credentials correctly but I receive error `` Error: P1001: Can't reach database server at sayonce.cglt0pzzqenk.eu-central-1.rds.amazonaws.com:5432` ...

Using next-auth on my Vercel website. Google thinks the Auth routes are phishing

I've attached [auth].ts in my code. It is the boilerplate with the exception of my providers and a firestore adapter. Google thinks every single one of my auth endpoints is compromised. Is firestore the reason why Google thinks the auth is phishing? Is there something I need to do with t3?