Tribe
Tribe
Explore posts from servers
TtRPC
Created by Tribe on 3/20/2024 in #❓-help
Getting the type of context
Is it possible to get the type on a context object that is passed into a specific TRPC procedure after it is modified by the middleware? If so, whats the best way to go about this? Thanks
10 replies
TTCTheo's Typesafe Cult
Created by Tribe on 1/28/2024 in #questions
TRPC RSC calls forced to use no_store
Curious what the take is over here on having to flag every TRPC api call made server side with no_store, in order to avoid build errors from the next compiler? I tried bringing this up over on the Next Discord since it feels more like an issue that Next should not be throwing an error. And having to use no_store in every RSC with a serevr side api call feels like a bit of an anti pattern. But they kind os suggested this was more of an issue with t3 or TRPC, which I an leaning towards disagreeing with. Thoughts on this or recommended work arounds?
4 replies
TtRPC
Created by Tribe on 1/10/2024 in #❓-help
Dynamic Server Usage Error from RSC calls
No description
7 replies
TTCTheo's Typesafe Cult
Created by Tribe on 1/10/2024 in #questions
Base t3 app throwing: Dynamic Server error on build
Noticed I was getting a Dynamic server error on a recent t3 app using postgress with Drizzle and I realized simply changing out the Drizzle client (and config) causes the build process to throw a Dynamic server usage error on build. Placing cookies() in the default RSC that comes with T3 seems to cause the error to go away, but that feels like a bit of a hack. Is this also something that occurs with the planetscale setup or is there something wrong with my Drizzle client? Update: I just actually created a planetscale account to test out default settings and it appears the error gets thrown with default planetscale/drizzle as well. Is this a known issue or are there any workarounds? Thanks Drizzle client
import { drizzle } from "drizzle-orm/postgres-js";

import { env } from "~/env";
import * as schema from "./schema";
import postgres from "postgres"

const client = postgres(env.DATABASE_URL)

export type Drizzle = typeof db
export const db = drizzle(client, { schema });
import { drizzle } from "drizzle-orm/postgres-js";

import { env } from "~/env";
import * as schema from "./schema";
import postgres from "postgres"

const client = postgres(env.DATABASE_URL)

export type Drizzle = typeof db
export const db = drizzle(client, { schema });
Drizzle config
import { type Config } from "drizzle-kit";

import { env } from "~/env";

export default {
schema: "./src/server/db/schema.ts",
driver: "pg",
dbCredentials: {
connectionString: env.DATABASE_URL,
},
tablesFilter: ["debug_*"],
} satisfies Config;
import { type Config } from "drizzle-kit";

import { env } from "~/env";

export default {
schema: "./src/server/db/schema.ts",
driver: "pg",
dbCredentials: {
connectionString: env.DATABASE_URL,
},
tablesFilter: ["debug_*"],
} satisfies Config;
9 replies
TTCTheo's Typesafe Cult
Created by Tribe on 12/25/2023 in #questions
Adding Supabase to TRPC context
I am using Supabase for auth and db in a create t3 app project and I was curious if this would be the correct way to get the user session data into the trcp context. I modified the createTRCPContext method to this... server/api/trpc.ts
import { cookies } from 'next/headers'
import { createRouteHandlerClient } from "@supabase/auth-helpers-nextjs"
import type * as schema from "../db/schema";

export const createTRPCContext = async (opts: { headers: Headers }) => {
const cookieStore = cookies()

const supabase = createRouteHandlerClient<typeof schema>({
cookies: () => cookieStore,
})

const session = await supabase.auth.getSession()

return {
db,
session,
...opts,
};
};
import { cookies } from 'next/headers'
import { createRouteHandlerClient } from "@supabase/auth-helpers-nextjs"
import type * as schema from "../db/schema";

export const createTRPCContext = async (opts: { headers: Headers }) => {
const cookieStore = cookies()

const supabase = createRouteHandlerClient<typeof schema>({
cookies: () => cookieStore,
})

const session = await supabase.auth.getSession()

return {
db,
session,
...opts,
};
};
or alternatively is it actually possible to just create a supabaseServerClient / createRouteHandlerClient within the TRCP procedures themselves whenever I need access to the session data?
11 replies
DIAdiscord.js - Imagine an app
Created by Tribe on 10/9/2023 in #djs-questions
Docker ports on GCP & AWS
I recently dockerized my bot and have it running fine off my local machine, however when deploying it the bot hangs on when the client tries to login. I found a post mentioning that certain ports on GCP and AWS needed to be exposed but they didnt mention which. Anyone run into a similar issue with docker and those hosts? Turns out it actually is logging in, it just isn't recieving the slash commands. I have tried exposing ports 80 and 443 but no luck with those.
14 replies
DIAdiscord.js - Imagine an app
Created by Tribe on 10/25/2022 in #djs-questions
awaitMessageComponent method on InteractionResponse
When sending a reply containing a component row, the returned value is an InteractionResponse which contains and awaitMessageComponent method. I would assume this method would collect the user input of the component sent that returned this InteractionResponse, however it always seems to fail yet placing a message collector on the channel gets the user input I expected. Is putting the collector on the channel just the intended way of getting the response on the component I send or am I doing something wrong?
const response = await submition.reply({ components: [ selectMenuComponent ]})

const selected = response.awaitMessageComponent({
filter: (i) => {
i.deferUpdate()
return i.user.id === response.interaction.user.id
},
time: 120_000,
componentType: ComponentType.SelectMenu
})
const response = await submition.reply({ components: [ selectMenuComponent ]})

const selected = response.awaitMessageComponent({
filter: (i) => {
i.deferUpdate()
return i.user.id === response.interaction.user.id
},
time: 120_000,
componentType: ComponentType.SelectMenu
})
3 replies
DIAdiscord.js - Imagine an app
Created by Tribe on 8/16/2022 in #djs-questions
permissions_new from API
I am assuming the permissions_new property being returned from the API is the new Bitwise permissions flags they recently implemented. My question is, can I rely on this property remaining or will they eventually swap it out with the usual permissions property? Also I was trying to type the result with RESTAPIPartialCurrentUserGuild but its missing this new permissions property, does anyone know which type includes it? Thanks
15 replies
DIAdiscord.js - Imagine an app
Created by Tribe on 8/1/2022 in #djs-questions
Mentionables breaking on mobile
I don't think this is specific to discord.js but I've noticed that occasionally mentionables will break and instead show <@USERID>but only on the mobile app. At first I assumed it was people leaving the server but that doesn't appear to be it. Does anyone know what causes this?
11 replies