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 Server
FFossil4/12/2024

How do you cache tRPC server responses w/Next App Router?

What is the correct way to cache tRPC endpoint responses create-t3-app@7.30.1 with Next App Router? Something so straightforward with fetch, yet I cannot figure it out with trpc. Cache-Control headers are overwritten by NextJs (https://nextjs.org/docs/app/api-reference/next-config-js/headers#cache-control)...
Ppython8u4/12/2024

I want to get information from the indexedDB and include this in the first render, without delay

The issue is that react code needs to be hydrated before being executed, so you can't get info from localStorage or indexedDB before hydration. The only thing I found that might help is this, https://www.joshwcomeau.com/react/dark-mode/ but it's only for setting CSS variables. chatGPT says there's no way to do this (scroll to bottom): https://chat.openai.com/share/dd719413-5c39-42f1-a695-456971288648 ...
Hhashcode4/12/2024

getting error while fetching from uploadthing

i am creating a next.js project where user can upload pdf file which we save using upload thing and later analyse it using open ai api. pdf file is getting uploaded correctly but getting an error while fetching the file: i have tried a lot, it will be really great if anyone can help...
No description
Ccrbon4/12/2024

tRPC external API access

I'm new to tRPC and not sure why this produces an error when an external POST request is sent to the /api/trpc/post.createExternal route. I'm trying to expose a tRPC route / procedure, so that an external service can POST to it Example POST ...
AAni4/12/2024

Next Auth google says redirect URI is broken but works on another project

Hi! I am working on a project and I keep getting the error: Access blocked: This app’s request is invalid ...
KKenzo4/12/2024

Next not doing SSG routes?? Am I missing something?

Hi, I need to do this page ssg instead of dynamic server rendered, i dont have any dependencies so i have no idea whats happening, gemini or chatgpt has no clue either....
VVision20234/12/2024

How to fix jupyterhub issue

Anyone have any experience with jupyterhub? I'm getting: TimeoutError: pod jupyterhub/jupyter-zfjryuibwedbvgjvmxrvjcfjybevht did not start in 300 seconds! ...
Ttyler49494/11/2024

P3005 Error running Prisma migrate

I am working on a NextJS project that uses prisma. I was able to define my initial schemas and deploy my initial migrations successfully. I made a small change in the diff screenshot attached to this message and I am able to run npx run db push with no issues. When I try to run npx prisma migrate dev to generate a migration, I get the following error: ``` Error: P3005 ...
VVilatoro4/11/2024

UTApi - server SDK uploadFilesFromUrl module error

I am getting a weird bug when uploading images using the utapi uploadFilesFromUrl. This is my server code for now, which is very similar to the one posted in the example. I am using bun, elysia, and the code is written in TypeScript. ``` const urlExample = "https://cdn2.hubspot.net/hubfs/53/image8-2.jpg";...
SSukrit4/11/2024

Vercel Date Issue

understand that Vercel servers have different dates compared to the client's date. Typically, this is resolved by marking a component as 'use client' to generate dates on the client side. However, I'm encountering an issue with my app's calendar feature. When the client sends a date to the server to fetch events, there's a discrepancy between the client's date and the server's date. This leads to events not being displayed correctly. For example, if I request events for April 11th, but the event's date in the database falls between 5:29 AM and 11:59 PM, it won't be displayed for that day. However, if the client's date is April 10th, then the event shows up. Events with dates between 12:00 AM and 5:29 AM work fine....
No description
Vvoolume.4/11/2024

Request -Website to analyze npm packages

Theo made a video on it but I forget the website name and cant find the video. The tool analyzes and NPM package and sorts it where you can see the functions, types , etc
AAni4/11/2024

Date being overridden in neon and drizzle orm

Hey! when I'm trying to store a date in drizzle orm and neon the date that's being written is overwritten here is the table: ```ts export const meetings = pgTable( "meeting", {...
Solution:
The date type doesn't contain hour/minute/second data and thus doesn't map well to a js date, it may be a good idea to try to use string mode instead or not use the date type at all and use a timestamp instead
EEXILE4/11/2024

What is a correct API route validation flow

I'm currently creating a learning platform similar to udemy just for some practice using Next.js (pages), Prisma, auth0, TypeScript, Postgres, Zod and I'm trying to create an API route for creating a new course. What should the flow look like in this API? (Idk if flow is the right word or if my title makes sense. correct me if I'm wrong) In order possibly?:...
AAbudi4/11/2024

API Monitoring, Logging from Scratch

Hello folks I have an assignment where I want to develop a rest monitoring tool where that tracks the status code, the method, response body, request body, cookies and tokens and every other important parameter whenever I send a request to a server How can I do this actually?...
Ppython8u4/11/2024

downsides to Using IndexedDB/LocalStorage as a cache?

I'm making a chat app where the user can send/receive messages, which are stored in supabase. I want to cache these messages client-side using IndexedDB or LocalStorage to allow users to instantly view their messages upon page exits and re-entries, without fetching from the db every time. To me, this just seems idiomatic, allowing for instant loading as well as saving bandwidth "localstorage/indexdb can be cleared by client" -> all caches get stale sometimes, just refetch "your localstorage is not accessible on other devices" -> that's fine, just fetch from server like normal "5mb limit for localstorage" -> indexedDB is limited by disk space...
JTFjohnny the fifth4/11/2024

You are using Node.js 16.17.0. For Next.js, Node.js version >= v18.17.0 is required.

i have installed the latest version of next js via npx create-next-app@latest i have node js version 20.12.1 i checked with node -v , i have also checked the path variable it does point to my node js folder ,i reinstalled node js , but unfourtuntely that all didn't work i am using npm run devto run the project
WWiznet4/11/2024

Do TRPC fetches need to be wrapped in react.useeffect?

I'm curious on how the use of TRPC api calls works with client and server components. Does TRPC handling the caching of results or do we need to still wrap our calls in a react use effect to prevent unnecessary calls? thank you!
Iindee4/11/2024

i have a doubt regarding google oauth token

bro i have a doubt . i have made a chat app with pocketbase with gmail oauth thing now i want to push it to github . will my oauth token be exposed ?
NMNoam Muallem4/10/2024

next js on vercel revising home page after 404 does not re-render

Hi, I have a t3 stack app (basic but with clerk and not next auth). on local wen I navigate to my broken 404 page and back home, everything seems to be find but on production (vercel) when I go back to the home page, it does not re-render and stack on the 404. Any help will be appreciated... I am using chad cn for the navbar, this is the link component: ```...
Next