Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(economy): don't await/.catch the fire-and-forget logAudit after a swap

nirholas27d12403b46a
diff --git a/api/cron/economy-rebalance.js b/api/cron/economy-rebalance.js
index c388265a7..60e32cf34 100644
--- a/api/cron/economy-rebalance.js
+++ b/api/cron/economy-rebalance.js
@@ -129,10 +129,14 @@ export default wrapCron(async (req, res) => {
const r = await executeSwap({ connection, keypair, leg, solPriceUsd, network: NETWORK });
results.push(r);
if (r.status === 'swapped') {
- await logAudit({
+ // logAudit is fire-and-forget: it schedules its own microtask, swallows
+ // its own DB errors, and returns undefined — so do NOT await or .catch it
+ // (that threw "reading 'catch'" on every successful swap), and the payload
+ // field is `meta`, not `detail`.
+ logAudit({
action: 'economy_rebalance_swap',
- detail: { name: r.name, dir: r.dir, inUsd: r.inUsd, signature: r.signature },
- }).catch(() => {});
+ meta: { name: r.name, dir: r.dir, inUsd: r.inUsd, signature: r.signature },
+ });
}
} catch (err) {
results.push({ name: leg.name, status: 'failed', reason: err.message?.slice(0, 160) });