Salumsu
Salumsu
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Y7YA on 8/11/2024 in #questions
Server actions in server components
up
6 replies
TTCTheo's Typesafe Cult
Created by Hobbs on 8/13/2024 in #questions
T3 Next Auth / TRPC Documentation is outdated
I just put it inside server/auth just like t3, and Im also using drizzle. I think that you need to add the adapter when you want to use oauth. You can integrate it with trpc middleware by going to /server/api/trpc.ts then import auth from your nextauth.
import { auth } from "../auth";
export const createTRPCContext = async (opts: { headers: Headers }) => {
const session = await auth();

return {
db,
session,
...opts,
};
};
import { auth } from "../auth";
export const createTRPCContext = async (opts: { headers: Headers }) => {
const session = await auth();

return {
db,
session,
...opts,
};
};
just like this, and it will be available on the ctx. here's how you create a protected procedure
export const protectedProcedure = t.procedure
.use(timingMiddleware)
.use(({ ctx, next }) => {
if (!ctx.session?.user) {
throw new TRPCError({ code: "UNAUTHORIZED" });
}

return next({
ctx: {
...ctx,
session: { ...ctx.session, user: ctx.session.user },
},
});
});
export const protectedProcedure = t.procedure
.use(timingMiddleware)
.use(({ ctx, next }) => {
if (!ctx.session?.user) {
throw new TRPCError({ code: "UNAUTHORIZED" });
}

return next({
ctx: {
...ctx,
session: { ...ctx.session, user: ctx.session.user },
},
});
});
5 replies
TTCTheo's Typesafe Cult
Created by Hobbs on 8/13/2024 in #questions
T3 Next Auth / TRPC Documentation is outdated
I just didn't choose authjs in the cli and followed auth js documentation. Maybe you could do the same?
5 replies
DTDrizzle Team
Created by Axelin on 8/11/2024 in #help
NEXTJS: module not found: net
You can do either of these: - Create an api endpoint for querying the database and create a function that fetches that endpoint. - Create a server action, some people don't recommend this when you're dealing with authentication and sensitive info (such as api keys)
3 replies
DTDrizzle Team
Created by Axelin on 8/11/2024 in #help
NEXTJS: module not found: net
I don't think you can use db on the client. And since getProvncias is using it, which you are directly using on the client, you would expect some errors.
3 replies
DTDrizzle Team
Created by Salumsu on 8/6/2024 in #help
Where to define Postgres Triggers?
Thank you very much!
6 replies
DTDrizzle Team
Created by Salumsu on 8/6/2024 in #help
Where to define Postgres Triggers?
Im also using T3 stack. (NextJS 14 App Router)
6 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
nah, wans't really referring to t3 hahahaa. Its just an expression out of frustration. I did some research and I think my problem isn't caused by t3 at all, its because of the adapter just not having the right type.
27 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
This sucks dude haahahha
27 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
No description
27 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
No description
27 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
are you talking about the npx auth secret?
27 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
Can someone please teach me
27 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
I mean, how do you even use next auth properly? the setup in t3 app is different compared to what I'm used to.. the NextAuth is returning any, how do I get the handlers, signIn, signOut, etc.?
27 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
have you added the client id and secret id?
27 replies