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

how to delete a child object in prisma

how do i remove one follower from the followers array ``` model User { id String @id @unique @default(cuid()) handle String @unique @default(cuid())...

How to return multiple prisma calls with trpc

how do i return two prisma calls ``` follow: protectedProcedure.input(z.object({ userid: z.string(), pageid: z.string() })).mutation(async ({ input, ctx }) => { ctx.prisma.user.update({ where: {...

Proxy prisma calls to FE with tRPC

Hi there. First of all, I'd like to thank everyone involved in the T3 project. It is really awesome. I have a question. Is there a way to just proxy prisma calls to FE with tRPC? So that we don't have to create procedures, duplicate inputs... Just something like: ``` export const appRouter = router({...

Prisma allowing empty DB fields

Hey guys. Day one of using Prisma, so probably something simple Im missing or not understanding. From reading docs, if no type modifer is provided, the default behaviour is fields are not null. That being said, it is letting me submit records without certain fields missing. I have created records through both my TRPC endpoint, and Prisma Studio, and in both I can omit a field and it doesn't reject it. Attached a screenshot of my model and an example record. Any ideas?

NextAuth-Try signing in with a different account

When I log in with my account everything works fine. But when anyone else tries to login they get this message: "Try signing in with a different account" I see there is an open issue exactly on this: https://github.com/nextauthjs/next-auth/issues/3830 Just curious if anyone is aware of an easy fix for t3 stack? Thanks...

media files do not show on my netlify site when I deploy my astro project.

I have this astro project working just fine on my local machine. when I do build and preview everything works as expected. but when I deployed it on netlify all media files and favicon stopped working. I have some fonts in the src directory and they work fine. but the media files in public directory do not show up. ...

Confused on types of prisma responses, and how to access the data inside.

The NextAuth 'Account' model in prisma has a 'access_token' property that I need to access for a API call on the server. However, the only property I can access in the trpc context is the "session" model. So, what I am doing is querying users for the user that has the session from the context, then getting the account array from that user and getting the account from there. (1st image) ...

Do Planet Scales 'Dump' & 'Restore-Dump' via the CLI restore data + schemas or JUST the schemas?

Maybe a silly question: If I do a pscale database dump [database] [branch], will this save and backup the data, and then I can restore the database including all schemas + saved data via restore-dump <DATABASE_NAME> <BRANCH_NAME> ? Or will it just restore the schemas? ...just asking to make extra sure, I'm a little scared 😅...

How do I type my query data?

I want to send over some data in my query, but i'm unsure what type definition needs to be updated for this, and how to access it on ctx in the serverside I perhaps thought it could be inferred, but maybe not the case...

AWS Spending Limit

Hello, Recently, I have heard that you can now set a hard spending limit on AWS services and if you have reached the limit, the service stops. I want to use this for AWS SES for sending e-mails but don't know if you really can set spending limits....

backend stack suggestions

Hello good day I am trying to build a new project and looking to explore new stuff Like languages and frameworks This web app will be real-time with websocket stuffs...

The `protectedProcedure` doesn't seem protected?

It seems that all the function does, is check whether we've sent a username.
I have enabled "strategy: "jwt" in next-auth, so my understanding is that NextJS encrypts the token it's received from auth provider, and now uses this to determine whether we're logged in etc. In terms of making authenticated requests, should we not be doing something like decrypting the access_token in the protectedProcedure handler, and getting the user / scope from that, and then assume the user is actually who they say they are (rather than trusting the client who could send any username)...

Want to create a collaborative editor with Next.js

I am currently trying to figure out yjs with next.js. Are there any better alternatives for react based applications?

T3 Stack Next - Correct method for automating functions every X mins

When using GoogleFu, the usual results are setInterval and run endlessly, but is that the correct method for things happening every 10 minutes for like.. multiplicative datasets? Additionally, is best practice to offload this from the T3 stack and run a separate program? Thanks for all the help!...

After a user submits their email to next-auth, how to pass it to the check email page?

question with next-auth email provider. After a user submits their email, they get sent to the check-email page.... How can I pass that email address through to the check email page?...

A very basic thing that can not be done right using NextAuth?

I have an app that uses DB sessions. I've got an /admin route that I want to protect using a Next.js middleware by checking the user's role, but I can't do this because I don't have access to 'user' obj. How can I do this right without having to copy-paste a block of getServerSideProps?...

Auth solution for encrypting, not hashing, passwords

I'm working on an application where a user signs up with identical credentials from another website. We then use that password to scrape that website (with permission) and display data on web and mobile apps. Are there 3rd party auth providers who allow you to encrypt a user's password instead of hashing it? I've looked around for a bit and I'm not sure if I can access a user's password from Auth0 or Clerk.dev....

First Prisma thing with next-auth

Hi guys, I'm trying to get started with prisma, and i thought on eof the first thigns i should do was to add a logins count to the user's account .... Im just getting a simple "ERROR" ...

serverless background jobs?

any cool services or providers to enable something like enqueuing jobs in a way that makes sense for a serverless stack? this is a side project so i just want to try options...

Quick Config Question

Id appreciate a quick explanation of what the @type is here? I see this in a a lot of config files. Is it JSDoc? Is it typescript stuff? A mix it seems? Do we only add it for autocomplete on the config object? Is visual studio code automatically doing this somehow? Thanks...