diff --git a/consumer/src/inbox.ts b/consumer/src/inbox.ts index a6bc608..8c54d5b 100644 --- a/consumer/src/inbox.ts +++ b/consumer/src/inbox.ts @@ -1,4 +1,5 @@ import type { InboxMessageBody } from 'wildebeest/backend/src/types/queue' +import { getDatabase } from 'wildebeest/backend/src/database' import * as activityHandler from 'wildebeest/backend/src/activitypub/activities/handle' import * as notification from 'wildebeest/backend/src/mastodon/notification' import * as timeline from 'wildebeest/backend/src/mastodon/timeline' @@ -8,7 +9,7 @@ import type { Env } from './' export async function handleInboxMessage(env: Env, actor: Actor, message: InboxMessageBody) { const domain = env.DOMAIN - const db = getDatabase(env) + const db = getDatabase(env as any) const adminEmail = env.ADMIN_EMAIL const cache = cacheFromEnv(env) const activity = message.activity diff --git a/consumer/src/index.ts b/consumer/src/index.ts index c607f9f..0881094 100644 --- a/consumer/src/index.ts +++ b/consumer/src/index.ts @@ -20,10 +20,11 @@ export type Env = { export default { async queue(batch: MessageBatch, env: Env, ctx: ExecutionContext) { const sentry = initSentryQueue(env, ctx) + const db = getDatabase(env as any) try { for (const message of batch.messages) { - const actor = await actors.getActorById(getDatabase(env), new URL(message.body.actorId)) + const actor = await actors.getActorById(db, new URL(message.body.actorId)) if (actor === null) { console.warn(`actor ${message.body.actorId} is missing`) return