Tony
Tony
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Tony on 1/17/2023 in #questions
Image upload using prisma + trps
I did look at it, I was looking for an alternative like using cloudinary or sth coz I once used aws on a diff service and it maxed out my card :(. so I never been a fan ever since
6 replies
TTCTheo's Typesafe Cult
Created by Tony on 12/28/2022 in #questions
AuthSession in T3 boiler plate not working when fetching data in SSG with tRPC
Ooh shoot I guess that will fix the error
16 replies
TTCTheo's Typesafe Cult
Created by Tony on 12/28/2022 in #questions
AuthSession in T3 boiler plate not working when fetching data in SSG with tRPC
Yeah I have checked that and its included on the t3 boiler plate. But the error is occuring on this line return await unstable_getServerSession(ctx.req, ctx.res, authOptions); which comes from the file in server/common/get-server-auth-session. What am i missing
16 replies
TTCTheo's Typesafe Cult
Created by Tony on 12/28/2022 in #questions
AuthSession in T3 boiler plate not working when fetching data in SSG with tRPC
aight let me look on it
16 replies
TTCTheo's Typesafe Cult
Created by Tony on 12/28/2022 in #questions
AuthSession in T3 boiler plate not working when fetching data in SSG with tRPC
That's what kept me wondering, but the error occurs once I fetch data in getStaticProps Here is the code I use
export async function getStaticProps(context: GetStaticPropsContext) {
const ssg = createProxySSGHelpers({
router: appRouter,
ctx: await createContext(),
transformer: superjson,
});
await ssg.sanity.getReports.prefetch(context.params.slug as string);
return {
props: {
trpcState: ssg.dehydrate(),
},
revalidate: 10,
};
}
export async function getStaticProps(context: GetStaticPropsContext) {
const ssg = createProxySSGHelpers({
router: appRouter,
ctx: await createContext(),
transformer: superjson,
});
await ssg.sanity.getReports.prefetch(context.params.slug as string);
return {
props: {
trpcState: ssg.dehydrate(),
},
revalidate: 10,
};
}
16 replies
TTCTheo's Typesafe Cult
Created by Tony on 12/1/2022 in #questions
Deploying the t3-App on Vercel
yeah that worked Thanks mate
15 replies
TTCTheo's Typesafe Cult
Created by Tony on 12/1/2022 in #questions
Deploying the t3-App on Vercel
strange enough the env variables are correct, I even added the planetscale integration on vercel so that it imports them correctly
15 replies
TTCTheo's Typesafe Cult
Created by Tony on 12/1/2022 in #questions
Deploying the t3-App on Vercel
here it is
15 replies
TTCTheo's Typesafe Cult
Created by Tony on 12/1/2022 in #questions
Deploying the t3-App on Vercel
generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "mysql"
url = env("DATABASE_URL")
relationMode = "prisma"
}

model Articles {
id String @id @default(cuid()) @db.VarChar(255)
title String @db.VarChar(255)
description String @db.VarChar(255)
imageUrl String @db.VarChar(255)
externalUrl String @db.VarChar(255)
}
generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "mysql"
url = env("DATABASE_URL")
relationMode = "prisma"
}

model Articles {
id String @id @default(cuid()) @db.VarChar(255)
title String @db.VarChar(255)
description String @db.VarChar(255)
imageUrl String @db.VarChar(255)
externalUrl String @db.VarChar(255)
}
15 replies
TTCTheo's Typesafe Cult
Created by Tony on 12/1/2022 in #questions
Deploying the t3-App on Vercel
If you mean the file where I export prisma client, or you meant the schema ?
15 replies
TTCTheo's Typesafe Cult
Created by Tony on 12/1/2022 in #questions
Deploying the t3-App on Vercel
import { PrismaClient } from "@prisma/client";

import { env } from "../../env/server.mjs";

declare global {
// eslint-disable-next-line no-var
var prisma: PrismaClient | undefined;
}

export const prisma =
global.prisma ||
new PrismaClient({
log:
env.NODE_ENV === "development" ? ["query", "error", "warn"] : ["error"],
});

if (env.NODE_ENV !== "production") {
global.prisma = prisma;
}
import { PrismaClient } from "@prisma/client";

import { env } from "../../env/server.mjs";

declare global {
// eslint-disable-next-line no-var
var prisma: PrismaClient | undefined;
}

export const prisma =
global.prisma ||
new PrismaClient({
log:
env.NODE_ENV === "development" ? ["query", "error", "warn"] : ["error"],
});

if (env.NODE_ENV !== "production") {
global.prisma = prisma;
}
15 replies