Froge
Froge
Explore posts from servers
CDCloudflare Developers
Created by Froge on 3/14/2024 in #general-help
OUTAGE - Try again in 5 minutes (Code: 1313)
Hello! I am trying to upgrade my Workers plan, for some reason it was downgraded for some time with us noticing. We're getting a number of 429s which we can't resolve without upgrading to paid Workers. Is there someone who can help with fixing out account, as we get the following error when trying to do anything within it?
Try again in 5 minutes. Your account is undergoing maintenance right now. (Code: 1313)
Try again in 5 minutes. Your account is undergoing maintenance right now. (Code: 1313)
Thanks!
15 replies
RRailway
Created by Froge on 1/15/2024 in #✋|help
❗Urgent - Deleted fork environment, all database volumes removed from production 🙃
alert were in the process of preparing to test an isolated environment, which was forked. We shut it down after it didn't work as expected, and it appears all our volumes from our databases in our development and production environments were removed... As it's a new environment backups were not enabled, we were actually in the process of setting them up, however we do have a backup from a few days ago. Thee was some important time series information in there, is there a way we can restore that database as we didn't explicitly delete it, so the volume (should, I hope) still exist in your backend and just need re-attaching.
46 replies
TTCTheo's Typesafe Cult
Created by Froge on 4/24/2023 in #questions
tRPC, Prisma, Discord Bot and tracking mass messages
Currently rebuilding building an app which is using NextJS (on Vercel), tRPC, Prisma, PlanetScale with a Discord bot all housed in a nice little Turborepo. Now, you can create posts from the web app that get posted to fairly large number of Discord Servers (~700, and growing). When the post gets approved by an admin (in the web app), it updates the post to approved through tRPC, tRPC calls the Discord bots little Express API to tell it to get the approved post and start sending the messages. Then the messages are being sent out to the Discord servers via the bot, which will create an entry in the DB to track the status. This is where I'm unsure, should the bot be creating those entries directly with Prisma initialized on the bot itself, or be going through tRPC on Next/Vercel. I suppose if I'm batch creating all those entries from the Discord Bot, and then making a single call back to tRPC, but again it'll likely be ~700 entries to create and I'm unsure on the efficiencies here, as if there's 10 posts, that's 7K entries just to track which messages have been sent... Or maybe there is a better way to track which messages have been sent?
68 replies
TtRPC
Created by Froge on 4/23/2023 in #❓-help
'useInfiniteQuery' hook disappeared after moving to Turborepo
I am using Turborepo with Next.js with the following layout, originally a T3 app - /apps/app - /packages/api The useInfiniteQuery hook seems to have dissapeared after migrating, and I can't get it back. I am using @trpc/next on the clientside, @trpc/react-query is installed, and everything seems fine? I'd love some guidance, I'm a little stuck... /apps/app/src/utils/api.ts
import { httpBatchLink, loggerLink } from "@trpc/client";
import { createTRPCNext } from "@trpc/next";
import superjson from "superjson";

import { type AppRouter } from "@myapp/api";

const getBaseUrl = () => {
if (typeof window !== "undefined") return ""; // browser should use relative url
if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`; // SSR should use vercel url
return `http://localhost:${process.env.PORT ?? 3000}`; // dev SSR should use localhost
};

config() {
return {
transformer: superjson,
links: [
loggerLink({
enabled: (opts) =>
process.env.NODE_ENV === "development" ||
(opts.direction === "down" &&
opts.result instanceof Error),
}),
httpBatchLink({
url: `${getBaseUrl()}/api/trpc`,
}),
],
};
},
ssr: false,
});
import { httpBatchLink, loggerLink } from "@trpc/client";
import { createTRPCNext } from "@trpc/next";
import superjson from "superjson";

import { type AppRouter } from "@myapp/api";

const getBaseUrl = () => {
if (typeof window !== "undefined") return ""; // browser should use relative url
if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`; // SSR should use vercel url
return `http://localhost:${process.env.PORT ?? 3000}`; // dev SSR should use localhost
};

config() {
return {
transformer: superjson,
links: [
loggerLink({
enabled: (opts) =>
process.env.NODE_ENV === "development" ||
(opts.direction === "down" &&
opts.result instanceof Error),
}),
httpBatchLink({
url: `${getBaseUrl()}/api/trpc`,
}),
],
};
},
ssr: false,
});
/packages/api/src/routers/job.ts
findMany: publicProcedure
.input(
z.object({
where: JobPostWhereInputSchema.optional(),
take: z.number().min(1).max(100).optional(),
cursor: z.string().nullish(),
order: JobPostOrderByWithRelationInputSchema.optional(),
})
)
.query(...)
findMany: publicProcedure
.input(
z.object({
where: JobPostWhereInputSchema.optional(),
take: z.number().min(1).max(100).optional(),
cursor: z.string().nullish(),
order: JobPostOrderByWithRelationInputSchema.optional(),
})
)
.query(...)
`/packages/api/src/root.ts
import { createTRPCProxyClient, httpBatchLink } from "@trpc/client";
import superjson from "superjson";
import { job } from "./routers/job";
import { profile } from "./routers/profile";
import { createTRPCRouter } from "./trpc";

export const appRouter = createTRPCRouter({
profile,
job,
});

export type AppRouter = typeof appRouter;

export const client = createTRPCProxyClient<AppRouter>({
transformer: superjson,
links: [
httpBatchLink({
url: "http://localhost:3000/api/trpc",
}),
],
});
import { createTRPCProxyClient, httpBatchLink } from "@trpc/client";
import superjson from "superjson";
import { job } from "./routers/job";
import { profile } from "./routers/profile";
import { createTRPCRouter } from "./trpc";

export const appRouter = createTRPCRouter({
profile,
job,
});

export type AppRouter = typeof appRouter;

export const client = createTRPCProxyClient<AppRouter>({
transformer: superjson,
links: [
httpBatchLink({
url: "http://localhost:3000/api/trpc",
}),
],
});
49 replies