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

Uploadthing and Clerk work together?

Hey all! I'm not a developer by any stretch of imagination, but I'm using Clerk for user management in a T3 web app I'm trying to develop. Can I use Uploadthing for the photos users will be uploading to their blog-like posts in my app or do I need to write my own auth code and forget about Clerk?

How to allow 3rd party apps to send POST requests to your API

I'm exporting data from a 3rd party app which sends a POST request to an api in my app. The problem is it works when I test it locally by exposing my local port through ngrok but when I deploy to Vercel my endpoint doesn't get hit at all and I get an error from the 3rd party app with a not so helpful error message. I've explored messing with CORS but that didn't fix it, assuming that I'm modifying the CORS settings correctly....

tanstack query (requests in bulk vs individual)

- There are times where I need to make requests for specific objects from my database, but there can be many objects per page. Currently, I am just doing a useQuery per object that I need. That works fine but I think it may be better at this point to just request the specific objects that I need all at once, as in, make a request for the specific ids that I want in a single request. That way there are fewer requests and fewer calls to my database. The problem then, is that I cannot make use of the nice caching mechanism that tanstack query provides. ...

t3 app in turborepo now throws 404 error when accessing root

hello. I created a new t3 app instance in turborepo and after making a number of changes, just out of nowhere do I just get these random 404 errors. I tried to create a new t3 app as well as a new next app and copy the root layout and page files to isolate the issue, but I'm getting a 404 error. I also tried deleting the .next directory. The issue I'm getting is the one in the attachment. I was able to create a fresh app out of the turborepo monorepo and fix the issue that way, but I'd rather...

env-nextjs error

Hey y'all. Working a new project using t3-oss/env-nextjs and I'm getting this error when trying to start up the app. Anyone seen this b4? ❌ Invalid environment variables: { NODE_ENV: [ "Expected 'development' | 'production', received object" ], DATABASE_URL: [ 'Expected string, received object' ],...

NextJS "Module not found" error with "loading.tsx"?

PS: i replaced the absolute path with <path> in the image....

vscode logging level

I've been asked by Sentry support to do this: "--log-level=debug", because I have an error of: "project not found" whenever i run "npm run build" . What I know is going to vscode settings and configuring some logs to debug mode. Is that what I suppose to do? Thanks!...

Zod z.infer, z.output and z.input

How do they differ? ``` export declare type TypeOf<T extends ZodType<any, any, any>> = T["_output"]; export declare type input<T extends ZodType<any, any, any>> = T["_input"];...

Passing function error on Contentful live preview client component

I'm trying to build a custom component for Contentful's live preview feature in Next 13 with the app directory. My idea is to create a client component which accepts a data prop from the parent, as well as a generic type to make the updatedData prop that's passed back down type-safe: ``` 'use client' ...

snake_case in Zod and/or Class

I am working with a Python Django back-end. It'd be most efficient to mimic the Django DB model fields in Zod to make communicating with the API more accessible. e.g. in Django I might have a Product.long_description field. Now, in my Next app I have a class Product with some useful getter methods for example. Ideally, I would have a Product.longDescription in TS To make creating and reading API responses <> Product classes more efficient, it'd be most efficient to use snake_case so I don't need to worry about re-assigning every API response field to a camelCase variable/property....

MacBook Air (15inch) vs MacBook Pro (14inch vs 16inch)

Hi everyone, I'm currently in the market for a new MacBook and I'm torn between the MacBook Air (15-inch) and the MacBook Pro (14-inch or 16-inch). I would greatly appreciate some guidance and advice in making this decision. My primary use for the MacBook will be web development, and I may also use Xcode occasionally. From what I've gathered, the MacBook Air seems like a solid option, but I'm also considering upgrading it to 512 GB of storage and 16 GB of memory, which brings it closer in price to the 14-inch MacBook Pro. and when im already spending so much money why not upgrade to the 16inch....... ...

Derive Type from Parameter of function attach to object (possibly recursive idk)

Hey Guys, so to explain what I'm doing, I'm basically defining a data structure to plug into a function of mine. The data structure is a key value and a class object that is defined on the fly. Like this ```ts...

Ignoring __test__ folder during the build process

Hey guys I am trying to ignore my test files during the build process but unable to progress, can someone please help me out, here's my tsconfig file ...

CRUD on Table Server Components

If I have a table that fetches data from my db, can I have the last column of the table have edit? or would that not be allowed and I'll have to use the client components instead?

Next.js App Directory redirecting POST route (oauth, sign in with google)

Hey folks! I'm implementing "Sign in with Google" using the Google Identity Services (GIS) package and these docs: https://developers.google.com/identity/gsi/web/guides/overview The TLDR is they provide a JS script and an HTML button. Once someone presses the button and authenticates successfully, GIS sends a POST request to URI that I give with the credential, csrf tokens etc....

Setting persistSession option.

I'm running a cron job on Vercel but I get this error:
No storage option exists to persist the session, which may result in unexpected behavior when using auth.
If you want to set persistSession to true, please provide a storage option or you may set persistSession to false to disable this warning.
No storage option exists to persist the session, which may result in unexpected behavior when using auth.
If you want to set persistSession to true, please provide a storage option or you may set persistSession to false to disable this warning.
Where do I set persistSession?...

TRPC works in local but got 404 in production

I am having this in my next.config.js ```javascript const nextConfig = { rewrites: async () => { return [...

Nextjs v13 app routing

When setting up my folders I just copy paste page.tsx , and for some reason some have hydration errors while others don't. Even if it is the same html. wondering why this happens. I'm just setting up my pages. app/about/page.tsx app/dashboard/page.tsx ( hydration error ) app/profile/page.tsx I tried npm cache clear --force, but for some reason the dashboard page will always error, and every page just looks like this ...

NextJS serverless limits

Hey guys, Is there anyway to increase this maximum limit? I need to upload significantly larger files. If not, do I change my route to not be a serverless function? I'm using the edge function as a proxy to upload the image for a different service and don't want to store it in a bucket or anything....