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

Handling Long-Running Server Functions in Next.js: Seeking Alternatives to Vercel Time Limits

Hey everyone! I'm working on a Next.js project where I need to sync and handle all new emails from an email server to a database. This process can take a couple of minutes, but I've noticed that Vercel has time limits of 10 seconds on the free hobby plan and 1 minute on the pro plan. Unfortunately, these limits are too short for my use case. Can you share any insights or alternatives you've used to handle long-running server functions in Next.js? Thanks in advance for your help!

Paypal webhooks

I've successfully set up paypal subscriptions inside a nextJS app whenever i subscribe using the paypal buttons, it works just fine, but the only event that's fired is BILLING.SUBSCRIPTION.ACTIVATED if i have my subscriptions be billed monthly, should i wait one month for the PAYMENT.SALE.COMPLETED event? i was expecting both BILLING.SUBSCRIPTION.ACTIVATED and PAYMENT.SALE.COMPLETED would fire when a user first subscribes, then PAYMENT.SALE.COMPLETED for the next payments...

planet scale cost confusion.

I'm new to wanting to work with big data, and I don't have a huge budget. Ideally $100 or less...hoping for someone with experience can advise here. - I want to use prisma with mySQL on planet scale but I plan on storing 2+ terabytes of data. - I see that is says $2.50 per extra GB which seems expensive? $2,500 = 1000gb - While AWS General Purpose SSD is about 0.23 USD per gb = $230 = 1000gb...
Solution:
nvm going to be hosting my db on an external hard drive and using compression for 70% extra space.

Tailwind, SASS, and PostCSS

I'm a beginner learning web dev, and I'm trying to understand the unique value that SASS and PostCSS bring to the table.
should I learn SASS and PostCSS with the same urgency as Tailwind (something I've perceived as more important to the webdev community)? or am I fine just learning tailwind and not worrying about the other two?...

Making CartContext available in trpc?

Hi! Simple trpc/t3 noob question. I made a CartContext provider wrapped around my app, and now I would like trpc to create the Stripe checkout url based on the items in the cart. How can I access cart.items? I guess I have to do something in trpc.ts? ```...

Help adding trpc-openapi to t3 app

Hi, can anyone help adding https://github.com/jlalmes/trpc-openapi properly to my existing t3 app? So far I have this ```ts import { generateOpenApiDocument } from 'trpc-openapi';...

question about specifying events in typescript

In this example, why is the element type of the FormEvent specified with this syntax like FormEvent<HTMLFormElement> is this just how it was designed that when you specify the form element of a form event, you place the element type in <> to the right of the event type?

Sending emails

Hey, wondering whats the best option to send emails to users. Right now sending emails for verifying the users email. Currently testing out gmail smtp, but I'm hearing about resend and sendgrid, etc. Why would I go with these services and not gmail smtp considering how easy it is to setup with something like nodemailer?

eslint plugin for ordering imports

Hey guys! Just wondering how people are sorting imports on save lol
Solution:
trivago's is out of date it seems, I used @ianvs/prettier-plugin-sort-imports

Add rest of User prisma table types and data to nextauth session in auth.ts

Hi, how can I add all the user data to the session including user table specified values and not just nextAuth? My current setup in the scaffolded T3 auth.ts is the following: ```TS...
Solution:
Hi, how can I add all the user data to the session including user table specified values and not just nextAuth? My current setup in the scaffolded T3 auth.ts is the following: ```TS...

React Cache Function

Hey, according to Next.js docs, you can cache db queries and similar with the cache function from React, however I do get an error when deploying to Vercel. https://nextjs.org/docs/app/building-your-application/data-fetching/caching#per-request-caching What can be the issue? ...

Hey guys, can you give me some general advice on this basic web project?

I'm a newbie, kind of trying to use BEM but I got too granular. Did my best with this project. Demo: https://juan-marin-liebre.onrender.com/ Repo: https://github.com/juandevac/mercado-clone ...
Solution:
try a framework astro is a great place to start...

Rendered more hooks than during the previous render Typescript error

Hey, I have a parameter on my page that im loading with with router.query. This is what my code looks like ...

View but not download with S3

Hi, I have a subscription service that allows users to view certain PDFs that I store on S3, in my NextJS app is there any way to allow the users to still view the PDF but if they try download it they get like a 403 (forbidden) error. I've found a youtube video that kinda does what I'm looking for (https://www.youtube.com/watch?v=x239gnCxGk0&lc=Ugyakc8uGhSM79WxoXd4AaABAg) but it doesn't work for me and I'm not sure how I'd do that with NextJs. Thanks...

Drizzle not pulling in environment variables

So originally my app was fine with the env variables originally but now it is not working. I am not sure what is going on. I have tried to use the dotenv package but that did not work. my drizzle config ```ts import { type Config } from 'drizzle-kit';...
Solution:
^- this. also, do you get the same error while building your app or just pushing? P.S. if you want to use dotenv as a workaround, you have to import variables using process.env.YOU_ENV_VAR as it won't affect the t3env env object...

Drizzle search column for string

Very noob question: Hey, I've switched to Drizzle, set up my tables. I've also looked into the filters and operations, but I cannot find any way to search a column for values containing x, e.g. for a search field of usernames. How can I do this in Drizzle? Any answer is greatly appreciated.

Understanding the t3-stack

so i'm just trying to understand the t3-stack better before I do more building with it (specifically the backend).. just want some clarification/corrections on my understanding so far nextauth - sessions/authentication for the app which can either be OAuth or email trpc - just an api kind of thing to semi-replace pages/api in nextjs that connects frontend to backend better?...

Handling memberships

Hi! We want to add memberships to our dashboard and hide specific sidebar menu options. What is best practice to handle these kind of things? Make a membership provider around the app? Or could I just call the api in the sidebar component ``` export function Sidebar({ className }: { className?: string }) { const pathname = usePathname();...

Uploading Word Documents (.docx/.docx)

I have been trying to upload .docx files using UploadThing. I used the following configuration: ``` bookUploader: f({ "application/msword": {...
Solution:
However, 5.2.0 is broken within the pages router, so if you're using the pages router, you'll have to use the 5.2.1 canary version, here: https://discord.com/channels/966627436387266600/1102510616326967306/1130159006292389898...