0sir1s
0sir1s
TTCTheo's Typesafe Cult
Created by Sawaid on 8/16/2023 in #questions
Can t3 app be deployed on a traditional server and a tradition database?
Basically, 1. Get a VPS 2. Clone your t3 app onto it 3. Set up firewall 4. Set up nginx 5. Set up some process manager, pm2, systemd or whatever you like 6. Certbot or cloudflare for your SSL certificate (https)
71 replies
TTCTheo's Typesafe Cult
Created by Sawaid on 8/16/2023 in #questions
Can t3 app be deployed on a traditional server and a tradition database?
You don't have to use digital ocean as your VPS/server obviously, but the steps should remain pretty universal
71 replies
TTCTheo's Typesafe Cult
Created by Sawaid on 8/16/2023 in #questions
Can t3 app be deployed on a traditional server and a tradition database?
71 replies
TTCTheo's Typesafe Cult
Created by Sawaid on 8/16/2023 in #questions
Can t3 app be deployed on a traditional server and a tradition database?
Or maybe this one
71 replies
TTCTheo's Typesafe Cult
Created by Sawaid on 8/16/2023 in #questions
Can t3 app be deployed on a traditional server and a tradition database?
71 replies
TTCTheo's Typesafe Cult
Created by Sawaid on 8/16/2023 in #questions
Can t3 app be deployed on a traditional server and a tradition database?
Surely you can just run Nginx and PM2 on your VPS and then just put your t3 app on there? This might be a good guide for you
71 replies
TTCTheo's Typesafe Cult
Created by 0sir1s on 8/6/2023 in #questions
How would I go about using Cloudflare R2
Ah okay thanks
7 replies
TTCTheo's Typesafe Cult
Created by 0sir1s on 8/5/2023 in #questions
Issue with trying to build with Nextauth
And in my schema.prisma
model User {
id String @id @default(cuid())
name String
email String @unique
password String
}
model User {
id String @id @default(cuid())
name String
email String @unique
password String
}
Instead of using id Int @id @default(autoincrement()), I instead changed it to what you see above
12 replies
TTCTheo's Typesafe Cult
Created by 0sir1s on 8/5/2023 in #questions
Issue with trying to build with Nextauth
CredentialsProvider({
name: 'Credentials',
credentials: {
email: { label: "Email", type: "text"},
password: { label: "Password", type: "password" },
},
// The above resolved the issues with the credentials type
async authorize(credentials)
CredentialsProvider({
name: 'Credentials',
credentials: {
email: { label: "Email", type: "text"},
password: { label: "Password", type: "password" },
},
// The above resolved the issues with the credentials type
async authorize(credentials)
12 replies
TTCTheo's Typesafe Cult
Created by 0sir1s on 8/5/2023 in #questions
Issue with trying to build with Nextauth
callbacks: {
session({ session, token}) {
if(token){
session.user.id = token.id;
session.user.name = token.name;
}
return session;
},
jwt({ token, user }) {
if (user) {
token.id = user.id;
token.name = user.name;
}
return token;
},
},
callbacks: {
session({ session, token}) {
if(token){
session.user.id = token.id;
session.user.name = token.name;
}
return session;
},
jwt({ token, user }) {
if (user) {
token.id = user.id;
token.name = user.name;
}
return token;
},
},
12 replies
TTCTheo's Typesafe Cult
Created by 0sir1s on 8/5/2023 in #questions
Issue with trying to build with Nextauth
Added this bit of code
declare module "next-auth" {
...
}
// This bit here
declare module "next-auth/jwt" {
interface JWT {
id: string;
}
}
declare module "next-auth" {
...
}
// This bit here
declare module "next-auth/jwt" {
interface JWT {
id: string;
}
}
12 replies
TTCTheo's Typesafe Cult
Created by 0sir1s on 8/5/2023 in #questions
Issue with trying to build with Nextauth
Got it to work, this is what I did.
12 replies
TTCTheo's Typesafe Cult
Created by 0sir1s on 8/5/2023 in #questions
Issue with trying to build with Nextauth
Yeah sure
12 replies
TTCTheo's Typesafe Cult
Created by 0sir1s on 8/5/2023 in #questions
Issue with trying to build with Nextauth
The main 2 issues are with the authorize function and compare(credentials?.password, user.password)
12 replies
TTCTheo's Typesafe Cult
Created by 0sir1s on 8/5/2023 in #questions
Issue with trying to build with Nextauth
Also, when trying to change the type of credentials from any, I am left changing it to this
async authorize(credentials: Record<string, string> | undefined)
async authorize(credentials: Record<string, string> | undefined)
However, that causes more issues with these 2 parts:
const user = await prisma.user.findUnique({
where: { email: credentials.email },
});
const user = await prisma.user.findUnique({
where: { email: credentials.email },
});
where credentials is possibly undefined, but I can fix that with credentials?.email, and same for anywhere else that access' credentials. However on this line:
const passwordMatch = await compare(credentials?.password, user.password);
const passwordMatch = await compare(credentials?.password, user.password);
I have an issue, with credentials?.password which shows this:
No overload matches this call.
Overload 1 of 2, '(s: string, hash: string): Promise<boolean>', gave the following error.
Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.
Overload 2 of 2, '(s: string, hash: string, callback?: ((err: Error, success: boolean) => void) | undefined, progressCallback?: ((percent: number) => void) | undefined): void', gave the following error.
Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.ts(2769)
No overload matches this call.
Overload 1 of 2, '(s: string, hash: string): Promise<boolean>', gave the following error.
Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.
Overload 2 of 2, '(s: string, hash: string, callback?: ((err: Error, success: boolean) => void) | undefined, progressCallback?: ((percent: number) => void) | undefined): void', gave the following error.
Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.ts(2769)
I am really unsure of what to do after searching on stackoverflow, and the rest of the internet. Any help would be greatly appreciated.
12 replies
TTCTheo's Typesafe Cult
Created by 0sir1s on 8/5/2023 in #questions
Issue with trying to build with Nextauth
Now it's easy enough to rid the first issue, but then more issues arise, such as this monstrosity from the authorize function
Type '(credentials: any) => Promise<{ id: number; name: string; email: string; } | null>' is not assignable to type '(credentials: Record<string, string> | undefined, req: Pick<RequestInternal, "query" | "body" | "headers" | "method">) => Awaitable<User | null>'.
Type 'Promise<{ id: number; name: string; email: string; } | null>' is not assignable to type 'Awaitable<User | null>'.
Type 'Promise<{ id: number; name: string; email: string; } | null>' is not assignable to type 'PromiseLike<User | null>'.
Types of property 'then' are incompatible.
Type '<TResult1 = { id: number; name: string; email: string; } | null, TResult2 = never>(onfulfilled?: ((value: { id: number; name: string; email: string; } | null) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | ... 1 more ... | undefined) => Promise<...' is not assignable to type '<TResult1 = User | null, TResult2 = never>(onfulfilled?: ((value: User | null) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined) => PromiseLike<...>'.
Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
Types of parameters 'value' and 'value' are incompatible.
Type '{ id: number; name: string; email: string; } | null' is not assignable to type 'User | null'.
Type '{ id: number; name: string; email: string; }' is not assignable to type 'User'.
Types of property 'id' are incompatible.
Type 'number' is not assignable to type 'string'.ts(2322)
Type '(credentials: any) => Promise<{ id: number; name: string; email: string; } | null>' is not assignable to type '(credentials: Record<string, string> | undefined, req: Pick<RequestInternal, "query" | "body" | "headers" | "method">) => Awaitable<User | null>'.
Type 'Promise<{ id: number; name: string; email: string; } | null>' is not assignable to type 'Awaitable<User | null>'.
Type 'Promise<{ id: number; name: string; email: string; } | null>' is not assignable to type 'PromiseLike<User | null>'.
Types of property 'then' are incompatible.
Type '<TResult1 = { id: number; name: string; email: string; } | null, TResult2 = never>(onfulfilled?: ((value: { id: number; name: string; email: string; } | null) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | ... 1 more ... | undefined) => Promise<...' is not assignable to type '<TResult1 = User | null, TResult2 = never>(onfulfilled?: ((value: User | null) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined) => PromiseLike<...>'.
Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
Types of parameters 'value' and 'value' are incompatible.
Type '{ id: number; name: string; email: string; } | null' is not assignable to type 'User | null'.
Type '{ id: number; name: string; email: string; }' is not assignable to type 'User'.
Types of property 'id' are incompatible.
Type 'number' is not assignable to type 'string'.ts(2322)
12 replies
TTCTheo's Typesafe Cult
Created by 0sir1s on 7/31/2023 in #questions
tRPC mutation and data
6 replies
TTCTheo's Typesafe Cult
Created by Aguilar on 7/30/2023 in #questions
VPN recommendation
I'd say it depends on what you want, if we go with security/privacy, go for a VPN whose company is based outside the 14 eye countries. A while ago I would've recommended VyprVPN, but their parent company had relocated to Texas I believe. Mullvad is definetly the best for complete privacy and anonymity from what I remember, since they make accounts for you and there's no personal information that goes into it. Another alternative would be protonvpn, since they recently made their pricing better as opposed to what it used to be which claimed that if you got a more expensive plan it'd have a cheaper price overall (it didnt). However, I have heard that they did leak information before about a customer's email with their mail solution protonmail so be weary of that.
10 replies
TTCTheo's Typesafe Cult
Created by 0sir1s on 7/14/2023 in #questions
Understanding the t3-stack
thanks for taking the time to explain it 😄
39 replies
TTCTheo's Typesafe Cult
Created by 0sir1s on 7/14/2023 in #questions
Understanding the t3-stack
I think i've got a basic understanding for it now
39 replies