shu
shu
Explore posts from servers
TTCTheo's Typesafe Cult
Created by shu on 5/20/2023 in #questions
Error when deploying T3-Turbo on vercel (using yarn)
Getting errors while trying to deploy to vercel, using the commands suggested on the repo readme as well. I'm using yarn as the pkg manager. The error im getting is "@acme%2Feslint" or "@acme%2db" not found. I can't use pnpm because it breaks the whole trpc type system for me.
5 replies
TtRPC
Created by shu on 5/19/2023 in #❓-help
tRPC type error on turborepo
Types of property 'query' are incompatible.
Type 'inferHandlerFn<{}>' is not assignable to type 'inferHandlerFn<any>'.
Types of parameters 'path' and 'path' are incompatible.
Type 'TPath' is not assignable to type 'never'.
Type 'string' is not assignable to type 'never'.
Types of property 'query' are incompatible.
Type 'inferHandlerFn<{}>' is not assignable to type 'inferHandlerFn<any>'.
Types of parameters 'path' and 'path' are incompatible.
Type 'TPath' is not assignable to type 'never'.
Type 'string' is not assignable to type 'never'.
6 replies
TTCTheo's Typesafe Cult
Created by shu on 5/18/2023 in #questions
tRPC losing types on t3-turbo
I'm trying the t3 turbo repo, trpc loses type defs out of nowhere on nextjs, types work fine on expo, has anyone else experienced this? im not sure what information im suppose to give cause i have no idea what is even causing this. Thanks for any help. Using the latest version of t3-turbo
11 replies
TTCTheo's Typesafe Cult
Created by shu on 4/30/2023 in #questions
why do i keep getting errors like errors like this on t3 turbo when trying to install packages
I keep getting errors when trying to install packages, im on apps/expo right now
error An unexpected error occurred: "https://registry.yarnpkg.com/@acme%2fapi: Not found".
error An unexpected error occurred: "https://registry.yarnpkg.com/@acme%2fapi: Not found".
3 replies
TTCTheo's Typesafe Cult
Created by shu on 4/27/2023 in #questions
NextAuth on Apollo Client SSR
Sorry for the bit of a irrelevant question for the discord but is it possible to configure authLink with nextauth on apollo client ssr? My apollo client is basically this repo https://github.com/kellenmace/apollo-client-cache-rehydration-in-next-js/blob/main/lib/apolloClient.ts Plus with this auth link
const authLink = () => {
return setContext(async (_, { headers }) => {
const session = await getSession();

return {
headers: {
...headers,
authorization: `Bearer ${session?.token}`,
},
};
});
};
const authLink = () => {
return setContext(async (_, { headers }) => {
const session = await getSession();

return {
headers: {
...headers,
authorization: `Bearer ${session?.token}`,
},
};
});
};
Which is used in
function createApolloClient() {
return new ApolloClient({
ssrMode: typeof window === "undefined",
link: authLink().concat(
new HttpLink({
uri: process.env.NEXT_PUBLIC_API_URL,
}),
),
cache: new InMemoryCache({
typePolicies: {
Query: {
fields: {
posts: relayStylePagination(),
},
},
},
}),
});
}
function createApolloClient() {
return new ApolloClient({
ssrMode: typeof window === "undefined",
link: authLink().concat(
new HttpLink({
uri: process.env.NEXT_PUBLIC_API_URL,
}),
),
cache: new InMemoryCache({
typePolicies: {
Query: {
fields: {
posts: relayStylePagination(),
},
},
},
}),
});
}
Been on this issue for that last two days and im starting to feel like its not possible, PLEASE PROVE ME WRONG im about to go insane
1 replies
TTCTheo's Typesafe Cult
Created by shu on 4/8/2023 in #questions
Expo interactive mode on turborepo
How do enable interactive mode t3 clerk turborepo? if this is even possible.
12 replies
TTCTheo's Typesafe Cult
Created by shu on 1/25/2023 in #questions
Property 'handle' does not exist on type '{}'
How do i bypass "Property 'handle' does not exist on type '{}'" i am trying to pass the handle value to the session, and the handle value in fact exists in token.user and my code works accordingly as well, however typescript does not let me pass through this error. my code is as follows (this is inside the [nextauth].ts file)
callbacks: {
jwt: async ({ token, user }) => {
if (user) {
token.user = user;
}
return Promise.resolve(token);
},
session({ session, token }) {
if(token.user){
session.user = {
id: token.sub || "",
handle: token.user.handle, <-- here
email: token.email,
image: token.picture,
name: token.name
}
}
return Promise.resolve(session)
},
},
callbacks: {
jwt: async ({ token, user }) => {
if (user) {
token.user = user;
}
return Promise.resolve(token);
},
session({ session, token }) {
if(token.user){
session.user = {
id: token.sub || "",
handle: token.user.handle, <-- here
email: token.email,
image: token.picture,
name: token.name
}
}
return Promise.resolve(session)
},
},
1 replies
TTCTheo's Typesafe Cult
Created by shu on 12/24/2022 in #questions
how to delete a child object in prisma
how do i remove one follower from the followers array
model User {
id String @id @unique @default(cuid())
handle String @unique @default(cuid())
name String?
bio String?
email String? @unique
emailVerified DateTime?
createdAt DateTime @default(now()) @db.Timestamptz(3)
image String?
posts Post[]
accounts Account[]
sessions Session[]
comments Comment[]
likes Post[] @relation("likes")
followers User[] @relation("UserFollowers")
followersRelation User[] @relation("UserFollowers")
following User[] @relation("Userfollowing")
followingRelation User[] @relation("Userfollowing")
}
model User {
id String @id @unique @default(cuid())
handle String @unique @default(cuid())
name String?
bio String?
email String? @unique
emailVerified DateTime?
createdAt DateTime @default(now()) @db.Timestamptz(3)
image String?
posts Post[]
accounts Account[]
sessions Session[]
comments Comment[]
likes Post[] @relation("likes")
followers User[] @relation("UserFollowers")
followersRelation User[] @relation("UserFollowers")
following User[] @relation("Userfollowing")
followingRelation User[] @relation("Userfollowing")
}
my current function
unfollow: protectedProcedure.input(z.object({ userid: z.string(), pageid: z.string() })).mutation(async ({ input, ctx }) => {
const q1 = await ctx.prisma.user.update({
where: { id: input.userid },
data: {},
select: { following: { where: { id: input.pageid } } },
});
const q2 = await ctx.prisma.user.update({
where: { id: input.pageid },
data: { },
});

return { q1, q2 };
}),
unfollow: protectedProcedure.input(z.object({ userid: z.string(), pageid: z.string() })).mutation(async ({ input, ctx }) => {
const q1 = await ctx.prisma.user.update({
where: { id: input.userid },
data: {},
select: { following: { where: { id: input.pageid } } },
});
const q2 = await ctx.prisma.user.update({
where: { id: input.pageid },
data: { },
});

return { q1, q2 };
}),
2 replies
TTCTheo's Typesafe Cult
Created by shu on 12/24/2022 in #questions
How to return multiple prisma calls with trpc
how do i return two prisma calls
follow: protectedProcedure.input(z.object({ userid: z.string(), pageid: z.string() })).mutation(async ({ input, ctx }) => {
ctx.prisma.user.update({
where: {
id: input.userid,
},
data: {
following: {
set: {
id: input.pageid,
},
},
},
}),
ctx.prisma.user.update({
where: {
id: input.pageid,
},
data: {
followers: {
set: {
id: input.userid,
},
},
},
});
}),
follow: protectedProcedure.input(z.object({ userid: z.string(), pageid: z.string() })).mutation(async ({ input, ctx }) => {
ctx.prisma.user.update({
where: {
id: input.userid,
},
data: {
following: {
set: {
id: input.pageid,
},
},
},
}),
ctx.prisma.user.update({
where: {
id: input.pageid,
},
data: {
followers: {
set: {
id: input.userid,
},
},
},
});
}),
i tried this but did not work either
follow: protectedProcedure.input(z.object({ userid: z.string(), pageid: z.string() })).mutation(async ({ input, ctx }) => {
return () => {
ctx.prisma.user.update({
where: {
id: input.userid,
},
data: {
following: {
set: {
id: input.pageid,
},
},
},
}),
ctx.prisma.user.update({
where: {
id: input.pageid,
},
data: {
followers: {
set: {
id: input.userid,
},
},
},
});
}
}),
follow: protectedProcedure.input(z.object({ userid: z.string(), pageid: z.string() })).mutation(async ({ input, ctx }) => {
return () => {
ctx.prisma.user.update({
where: {
id: input.userid,
},
data: {
following: {
set: {
id: input.pageid,
},
},
},
}),
ctx.prisma.user.update({
where: {
id: input.pageid,
},
data: {
followers: {
set: {
id: input.userid,
},
},
},
});
}
}),
5 replies
TTCTheo's Typesafe Cult
Created by shu on 12/22/2022 in #questions
How to add more keys to session with next auth
how do i add more keys to the session which next auth creates thank you
4 replies
TTCTheo's Typesafe Cult
Created by shu on 12/21/2022 in #questions
How to use useMutation with create t3 app
i tried implementing useMutation but i could not get it to work... i tried this (https://trpc.io/docs/useMutation) solution i found on the trpc docs but could not get it to work any help is appreciated!
2 replies