.improb
.improb
TTCTheo's Typesafe Cult
Created by .improb on 6/1/2023 in #questions
cold starts
I’m having an issue with my first queries after the db going idle taking about 11s to 12s which is causing my vercel app to timeout as I am using SSR. I'm using standard t3 stuff (prisma, trpc) hosted on vercel and on neon. Is there a way to speed these up? I’ve - changed prisma to version 4.14.1 - made my vercel functions work from Singapore (southeast) sin1 and my neon instance is currently singapore - enabled jsonProtocol in prisma the query is quite small and when warmed up it works wonderfully. As long as I can get it under 10 seconds and not have it time out that would be very ideal.
2 replies
TTCTheo's Typesafe Cult
Created by .improb on 4/3/2023 in #questions
how to seperate dev vs prod db
Hi everyone I have a local dev db and a production db on railway however when ever I use my local dev db I need switch the env variable in my prisma schema to dev instead of prod. How do I have the prod version but continue to work with dev on my local machine
7 replies
TTCTheo's Typesafe Cult
Created by .improb on 2/2/2023 in #questions
How do I get my mutation to return a value?
Im trying to get my mutation to return the object after its been created. My router code is
createAnswerCollection: publicProcedure
.input(
z.object({
userId: z.string(),
})
)
.mutation(async ({ ctx, input }) => {
const answerCollectionObject = await ctx.prisma.answerCollection.create({
data: {
userId: input?.userId,
},
});
return answerCollectionObject;
}),
createAnswerCollection: publicProcedure
.input(
z.object({
userId: z.string(),
})
)
.mutation(async ({ ctx, input }) => {
const answerCollectionObject = await ctx.prisma.answerCollection.create({
data: {
userId: input?.userId,
},
});
return answerCollectionObject;
}),
And my front end code is
const getAnswerCollection = answerCollectionMutation.mutate({ userId });
console.log(`getAnswerCollection`, getAnswerCollection)
const getAnswerCollection = answerCollectionMutation.mutate({ userId });
console.log(`getAnswerCollection`, getAnswerCollection)
the console log keeps returning undefined. How do I get it to return the object? when I look at getAnswerCollection it says void
3 replies
TTCTheo's Typesafe Cult
Created by .improb on 2/2/2023 in #questions
Cant connect to localhost using t3 stack on windows
I've made a simple t3 app with discord for auth which was working great but randomly decided to stop working. Now every time I run the app and try and login it blocks localhost. I've tried all the recommended things like >changing to wsl2 >flushing the dns >restarting wsl Those seem to work temporarily but then it just goes back to refused localhost. I tried on firefox, edge, and chrome and all have the same issue. On my other laptop that runs ubuntu I've had no problems at all so I am assuming its something to do with WSL. Has anyone else had a similar issue?
1 replies