From ef8f74e62b254e6c43a7533073c86cec1a2548d4 Mon Sep 17 00:00:00 2001 From: Bilal Godil Date: Thu, 29 Jan 2026 12:18:11 -0800 Subject: [PATCH] fix typecheck --- apps/backend/scripts/db-migrations.tsup.config.ts | 8 +++++--- apps/backend/scripts/run-cron-jobs.ts | 6 +++--- .../api/latest/internal/external-db-sync/poller/route.ts | 4 +++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/apps/backend/scripts/db-migrations.tsup.config.ts b/apps/backend/scripts/db-migrations.tsup.config.ts index 72bb27ce9..5dda9ba65 100644 --- a/apps/backend/scripts/db-migrations.tsup.config.ts +++ b/apps/backend/scripts/db-migrations.tsup.config.ts @@ -12,6 +12,9 @@ const nodeBuiltins = builtinModules.flatMap((m) => [m, `node:${m}`]); // tsup config to build the self-hosting migration script so it can be // run in the Docker container with no extra dependencies. +type EsbuildPlugin = NonNullable[number]; +const basePlugin = createBasePlugin({}) as unknown as EsbuildPlugin; + export default defineConfig({ entry: ['scripts/db-migrations.ts'], format: ['esm'], @@ -32,7 +35,6 @@ const __filename = __fileURLToPath(import.meta.url); const __dirname = __dirname_fn(__filename); const require = __createRequire(import.meta.url);`, }, - esbuildPlugins: [ - createBasePlugin({}), - ], + // Cast to tsup's esbuild plugin type to avoid esbuild version mismatch in typecheck. + esbuildPlugins: [basePlugin], } satisfies Options); diff --git a/apps/backend/scripts/run-cron-jobs.ts b/apps/backend/scripts/run-cron-jobs.ts index 93c3d2f3e..4a5f57078 100644 --- a/apps/backend/scripts/run-cron-jobs.ts +++ b/apps/backend/scripts/run-cron-jobs.ts @@ -3,8 +3,8 @@ import { StackAssertionError } from "@stackframe/stack-shared/dist/utils/errors" import { runAsynchronously, wait } from "@stackframe/stack-shared/dist/utils/promises"; const endpoints = [ - "/api/latest/internal/external-db-sync/sequencer", - "/api/latest/internal/external-db-sync/poller", + "/api/latest/internal/external-db-sync/sequencer", + "/api/latest/internal/external-db-sync/poller", ]; async function main() { @@ -29,7 +29,7 @@ async function main() { // Vercel only guarantees minute-granularity for cron jobs, so we randomize the interval await wait(Math.random() * 120_000); } - }); + }); } } diff --git a/apps/backend/src/app/api/latest/internal/external-db-sync/poller/route.ts b/apps/backend/src/app/api/latest/internal/external-db-sync/poller/route.ts index 1bf7883bc..e78b0c9ea 100644 --- a/apps/backend/src/app/api/latest/internal/external-db-sync/poller/route.ts +++ b/apps/backend/src/app/api/latest/internal/external-db-sync/poller/route.ts @@ -1,7 +1,7 @@ import { upstash } from "@/lib/upstash"; import { globalPrismaClient, retryTransaction } from "@/prisma-client"; import { createSmartRouteHandler } from "@/route-handlers/smart-route-handler"; -import { OutgoingRequest } from "@prisma/client"; +import type { OutgoingRequest } from "@/generated/prisma/client"; import { yupBoolean, yupNumber, @@ -13,6 +13,7 @@ import { getEnvVariable, getNodeEnvironment } from "@stackframe/stack-shared/dis import { captureError, StatusError } from "@stackframe/stack-shared/dist/utils/errors"; import { wait } from "@stackframe/stack-shared/dist/utils/promises"; + export const GET = createSmartRouteHandler({ metadata: { summary: "Poll outgoing requests and push to QStash", @@ -71,6 +72,7 @@ export const GET = createSmartRouteHandler({ for (const request of requests) { try { + // Prisma JsonValue doesn't carry a precise shape for this JSON blob. const options = request.qstashOptions as any; const baseUrl = getEnvVariable("NEXT_PUBLIC_STACK_API_URL");