Mocha
Mocha
TTCTheo's Typesafe Cult
Created by Mocha on 8/26/2024 in #questions
Migrating from T3 to T3 Turborepo
That makes senese. I've got Apple Silicon too.
13 replies
TTCTheo's Typesafe Cult
Created by Mocha on 8/26/2024 in #questions
Migrating from T3 to T3 Turborepo
I can't share the source code, but the problem I'm having is probably with the new setup requiring the /packages folder. I'll search for a newer guide.
13 replies
TTCTheo's Typesafe Cult
Created by Mocha on 8/26/2024 in #questions
Migrating from T3 to T3 Turborepo
Do you get the same error when going directly with create-t3-turbo ?
13 replies
TTCTheo's Typesafe Cult
Created by Mocha on 8/26/2024 in #questions
Migrating from T3 to T3 Turborepo
Thanks! Seems like a lot has changed since then, so it's been taking me a little more than two hours. It links to some nonexistent files. I'm using Clerk and Drizzle. They assume NextAuth and Prisma. I'm getting this error when trying to run the root turbo install.
ERR_PNPM_CATALOG_ENTRY_NOT_FOUND_FOR_SPEC  No catalog entry 'prettier' was found for catalog 'default'.
ERR_PNPM_CATALOG_ENTRY_NOT_FOUND_FOR_SPEC  No catalog entry 'prettier' was found for catalog 'default'.
13 replies
TTCTheo's Typesafe Cult
Created by Mocha on 5/13/2024 in #questions
Next.js API Type Safety without tRPC?
TanStack libraries are awesome. Do you have some sample code or article that talks about this setup? Seems to me that the library works best either with tRPC or with external APIs. I haven't been able to find the "define a function and call it" experience anywhere else.
10 replies
TTCTheo's Typesafe Cult
Created by Mocha on 5/13/2024 in #questions
Next.js API Type Safety without tRPC?
It was this issue that's currently fixed, but I just prefer not having a dependency if I don't really need it. If I could achieve almost the same results without tRPC, then it's better to remove this layer and keep the setup simple to develop and to debug
10 replies
TTCTheo's Typesafe Cult
Created by Mocha on 5/12/2024 in #questions
[TRPCClientError]: Converting circular structure to JSON
idk what the issue was, but I recreated the setup and it works now
9 replies
TTCTheo's Typesafe Cult
Created by Mocha on 5/13/2024 in #questions
Next.js API Type Safety without tRPC?
Yes, but I'm talking about things other than Server Actions. They're not ideal for everything. That's why people still use tRPC with App Router.
10 replies
TTCTheo's Typesafe Cult
Created by Mocha on 5/13/2024 in #questions
Next.js API Type Safety without tRPC?
Yes, but I'm asking about the client side
10 replies
TTCTheo's Typesafe Cult
Created by Mocha on 5/12/2024 in #questions
[TRPCClientError]: Converting circular structure to JSON
For context, here's my createTRPCContext:
export async function createTRPCContext(_: { headers: Headers }) {
const session = auth()
return {
userId: session.userId,
orgId: session.orgId,
orgSlug: session.orgSlug,
db: supabase,
}
}
export async function createTRPCContext(_: { headers: Headers }) {
const session = auth()
return {
userId: session.userId,
orgId: session.orgId,
orgSlug: session.orgSlug,
db: supabase,
}
}
And supabase is exported from:
import { env } from '~/env'
import { createClient } from '@supabase/supabase-js'
import type { Database } from '~/db'

export const supabase = createClient<Database>(
env.SUPABASE_URL,
env.SUPABASE_ANON_KEY
)
import { env } from '~/env'
import { createClient } from '@supabase/supabase-js'
import type { Database } from '~/db'

export const supabase = createClient<Database>(
env.SUPABASE_URL,
env.SUPABASE_ANON_KEY
)
9 replies
TTCTheo's Typesafe Cult
Created by Mocha on 5/12/2024 in #questions
[TRPCClientError]: Converting circular structure to JSON
Yes, but I didn't know where to start looking, especially since everything has been working fine for weeks without touching the code or anything around the code. It's a deeper issue that occurs at this function
const enforceUserIsAuthed = t.middleware(async ({ ctx, next }) => {
if (!ctx.userId || !ctx.orgId || !ctx.orgSlug) {
throw new TRPCError({
code: 'UNAUTHORIZED',
message: JSON.stringify(ctx),
})
}

return next({
ctx: {
userId: ctx.userId,
orgId: ctx.orgId,
orgSlug: ctx.orgSlug,
},
})
})
const enforceUserIsAuthed = t.middleware(async ({ ctx, next }) => {
if (!ctx.userId || !ctx.orgId || !ctx.orgSlug) {
throw new TRPCError({
code: 'UNAUTHORIZED',
message: JSON.stringify(ctx),
})
}

return next({
ctx: {
userId: ctx.userId,
orgId: ctx.orgId,
orgSlug: ctx.orgSlug,
},
})
})
so I updated the code. It still gave me an error, but the error is just the ctx object that I passed, so we don't know what it actually is
import { stringify } from 'flatted'
///
message: stringify(ctx),
import { stringify } from 'flatted'
///
message: stringify(ctx),
9 replies
TTCTheo's Typesafe Cult
Created by beebae on 5/13/2024 in #questions
project idea suggestion?
Resizing, removing backgrounds, converting types, SVG to image
5 replies
TTCTheo's Typesafe Cult
Created by WellDon on 5/12/2024 in #questions
Have you tried mentorship
What's your goal?
2 replies
TTCTheo's Typesafe Cult
Created by Mocha on 5/12/2024 in #questions
[TRPCClientError]: Converting circular structure to JSON
And sometimes I get this in server logs:
[97;46m << query  #1 log.logs  {
input: undefined,
result: l [TRPCClientError]: Converting circular structure to JSON
--> starting at object with constructor 'Timeout'
| property '_idlePrev' -> object with constructor 'TimersList'
--- property '_idleNext' closes the circle
at l.from (/var/task/.next/server/chunks/696.js:7:53047)
at /var/task/.next/server/app/activity/page.js:1:48095
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
meta: undefined,
shape: undefined,
data: undefined,
[cause]: TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Timeout'
| property '_idlePrev' -> object with constructor 'TimersList'
--- property '_idleNext' closes the circle
at JSON.stringify (<anonymous>)
... 5 lines matching cause stack trace ...
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'INTERNAL_SERVER_ERROR',
name: 'TRPCError',
[cause]: TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Timeout'
| property '_idlePrev' -> object with constructor 'TimersList'
--- property '_idleNext' closes the circle
at JSON.stringify (<anonymous>)
at /var/task/.next/server/chunks/101.js:1:12977
at t (/var/task/.next/server/chunks/338.js:13:359299)
at a (/var/task/.next/server/chunks/338.js:13:359613)
at c (/var/task/.next/server/chunks/338.js:13:353322)
at /var/task/.next/server/app/activity/page.js:1:47939
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
}
},
elapsedMs: 47
}
[97;46m << query  #1 log.logs  {
input: undefined,
result: l [TRPCClientError]: Converting circular structure to JSON
--> starting at object with constructor 'Timeout'
| property '_idlePrev' -> object with constructor 'TimersList'
--- property '_idleNext' closes the circle
at l.from (/var/task/.next/server/chunks/696.js:7:53047)
at /var/task/.next/server/app/activity/page.js:1:48095
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
meta: undefined,
shape: undefined,
data: undefined,
[cause]: TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Timeout'
| property '_idlePrev' -> object with constructor 'TimersList'
--- property '_idleNext' closes the circle
at JSON.stringify (<anonymous>)
... 5 lines matching cause stack trace ...
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'INTERNAL_SERVER_ERROR',
name: 'TRPCError',
[cause]: TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Timeout'
| property '_idlePrev' -> object with constructor 'TimersList'
--- property '_idleNext' closes the circle
at JSON.stringify (<anonymous>)
at /var/task/.next/server/chunks/101.js:1:12977
at t (/var/task/.next/server/chunks/338.js:13:359299)
at a (/var/task/.next/server/chunks/338.js:13:359613)
at c (/var/task/.next/server/chunks/338.js:13:353322)
at /var/task/.next/server/app/activity/page.js:1:47939
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
}
},
elapsedMs: 47
}
9 replies
TTCTheo's Typesafe Cult
Created by Huilen on 3/31/2024 in #questions
Im a newbie creating a document editor and idk how to setup an architecture to save the data
Yes, especially if this is a personal project, please ignore that and just try to ship something functional as soon as you can. Nothing else matters before production. You can always optimize later, when you know more about what you wanna do!
16 replies
TTCTheo's Typesafe Cult
Created by Huilen on 3/31/2024 in #questions
Im a newbie creating a document editor and idk how to setup an architecture to save the data
What's your main concern here? Cost of bandwidth? Time to update? Cost of storage? * If it's the cost of bandwidth, and this is a new project, then I'd say this is premature optimization, which I get it, I'm guilty of this habit too : ) * If you're worried about the server handling too much, then you're fine. The server won't do much with it more than copying it. * Storage is cheap, so no worries, at least for now. * Time, the user doesn't need to await a result * Also, you're probably already doing this, but consider adding some sort of delay. One character maybe isn't worth sending a whole request, so you can wait till either the user types 3 chars or 3 seconds pass.
16 replies
TTCTheo's Typesafe Cult
Created by Mocha on 3/30/2024 in #questions
TRPCClientError: Unable to transform response from server
Turning off ssr in src/utils/api.ts seems to solve it, but it'd be nice if this can be used with SSR on.
3 replies
TTCTheo's Typesafe Cult
Created by Teodorant, Tech-Priest on 3/29/2024 in #questions
How do I migrate from Next-Auth to Clerk Auth?
I just migrated a project with >100 files. Theo's Chirp repo and tutorial helped. The hardest part is what comes after the setup. Like if you relied on Next Auth's user id, which will now have to be replaced with Clerk's.
5 replies
TTCTheo's Typesafe Cult
Created by ! AlexNotTheLion on 3/20/2024 in #questions
NextAuth.js (Auth.js) vs SuapbaseAuth
What makes you pick Lucia over Auth.js? Just curious. I’m not totally enjoying Auth.js. I just use it because it’s already set up with T3
9 replies
TTCTheo's Typesafe Cult
Created by Tazio on 3/20/2024 in #questions
Apple iMessage reply line CSS
SVG is probably the right tool for this. You could absolutely do it in HTML & CSS, but a simple SVG path, even with dynamic line length.
3 replies