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

Is my next-auth options written correctly?

[next/js ^12.3.4, next-auth ^4.12.3, prisma 5.3.1, next-auth/prisma-adapter 1.0.7] I have a bug where using next-auth getSession works in the server (getServerSideProps): `export async function getServerSideProps(context) {...
No description

How do I revalidatePath from a trpc router?

TRPCClientError: Invariant: static generation store missing in revalidateTag / I'm getting this error when I try to call revalidatePath from my trpc router. ```import { z } from "zod"; import { createTRPCRouter,...
Solution:
Ok solved it

What to do about Date not serializable when calling getServerSideProps?

https://clips.twitch.tv/DrabPatientKathyArsonNoSexy-O_B1C2XYw_9SFEg2 Do I have to use multiple types or is there a way around this?...
Solution:
/** * Run build or dev with SKIP_ENV_VALIDATION` to skip env validation. This is especially useful * for Docker builds. */ await import("./src/env.mjs");...

Cannot connect to Docker Postgres DB on second computer

I have a postgres database sitting in docker I am developing on two seperate computers, Notebook and Desktop. On Desktop everything works but on my Notebook I cannot authenticate to the DB This is the docker-compose.yml file. ``` version: '3.8'...

Upload file to UploadThing via url

I have an attachment URL from AirTable that I'd like to upload directly to UploadThing. Is something like this possible?
Solution:
NEVERMIND I FOUND UPLOADFILEFROMURL 😀

Invalid environment

I'm losing my mind with the .env stuff in t3. I set GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET in env.mjs and also set it in .env but it keeps telling me this: ```❌ Invalid environment variables: { GITHUB_CLIENT_ID: [ 'Required' ], GITHUB_CLIENT_SECRET: [ 'Required' ]...

Shadcn components don't work out of the box?

Perhaps a noob question, but I noticed that following the Date Picker component (Date Range Picker in example) is far from what shows up visually in the docs. Copy-pasted without changing any defaults, instructions followed exactly. Does anyone have any idea? Asking here since shadcn is somewhat popular here and T3 is used across the entire project Open issue on github (not me): https://github.com/shadcn-ui/ui/issues/1574...
No description

Redirect to Dashboard, or let user navigate themselves?

Hey, just a general UI/UX question, I have a recipes app with a home page and a dashboard (and more obvs), im not sure whether to automatically redirect the user to dashboard (if logged in) when they go to the root ("/") or to make them go to the dashboard themselves? I imagine the former, but not sure?

Missing Secret on UTApi

Everytime I try to call a function that comes from the UTApi in my server it returns an error ❌ tRPC failed on API_NAME: Missing UPLOADTHING_SECRET env variable. I have double checked the key is on the .env and even initialized the UTApi: as follow import { UTApi } from "uploadthing/server"; ...

./run.sh setenv: invalid argument

Hi guys I was building an real time chat server with redis and upstash and I got this weird error. I export 2 environmental variables. Does anyone know why and where should I look for a solution? Dockerfile and docker-compose file should be fine.

Delete Uploadthing files

Hi guys, I am sorry if this is a stupid question but can i delete images uploaded to Uploadthing directly from my backend? I couldn't find it anywhere in the docs. I am starting to accumulate a tone of useless files...

Proper 3rd party APIs config in Next.js

Hey everyone, I tried to move a set of serverless functions to a standalone Fastify server for some reasons which are not relevant to this question. I faced an issue with request headers when I tried sending requests using fetch to my Fastify server. The headers coming from Next.js were totally different from the headers I'd expected. I tried comparing headers from my Next.js API route and from Fastify, and they were missing some fields like the Clerk auth token. I edited the next.config.js like so to solve this issue...

Understanding Next-Auth role in my app.

Hi everyone, I'm working on my first project with the T3 stack, and apart from TypeScript , Next.js, Prisma, and Tailwind, the rest is pretty new to me. I have already created the signup and login flow with tRPC and Next-Auth, but I'm in serious doubt about whether my understanding of what Next-Auth is for is correct. I mean, I'm using MongoDB but a JWT strategy for the session. I'm using the credentials approach as it is a requirement from the project. I'm using Next-Auth for the login process...

issues #1580

I understand what it says, but unable to find any dockerfile to update so kinda I have not yet understood (Screen shot below)...

What are these Typescript completion suggestions inside Prisma?

When I CNTRL + SPACE inside a date.set in Prisma, I get these strange autocompletes, like getUTCDate(). getUTCMonth(), toDateString() etc... I was trying to use them, but I don't understand what they are? Does someone know?...
No description

Deploying t3-stack with docker

I am trying to deploy t3 stack app with docker using the Dockerfile config provided in the docs. The server is starting but crashing when i hit the url. Error: Listening on port 3000 url: http://f80c580251b7:3000...

eslint fails in default t3 project

I just created a fresh t3 app and ran pnpm lint and I get a number of linting errors. How can I fix this?...
No description

Database migrations

Is there any tool to create migrations with typescript script support? like django or alembic has?? I only found kysely, which has a migration system but you still have to write your own migrations, which seem pretty stupid due to the fact that you have all the types to make it automagically...

nextjs font loads on local dev environment, but not on production

My nextjs app (using app dir) is using next/font to load the inter font for my entire app like so: ```import { Inter } from "next/font/google"; const inter = Inter({ subsets: ["latin"] }); ...
No description

SVGR and next/Image

Hey guys, a noob question I'm wondering if there is any difference in using one of these to render svgs? Like which one is the most effective way to use svg? Can't really wrap my head around it 😂