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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(inference-nodes): stop a missing DATABASE_URL 500-ing result submission
nirholase4857d404ea4
diff --git a/api/_lib/inference-nodes.js b/api/_lib/inference-nodes.jsindex 3b650a080..2c5baa41b 100644--- a/api/_lib/inference-nodes.js+++ b/api/_lib/inference-nodes.js@@ -270,6 +270,14 @@ export async function failJob(jobId, { publicKey, error: errMsg }) {function bumpNodeCounter(publicKey, column) {// Best-effort: the Redis result is authoritative; the counter is a rollup.- sql`update inference_nodes set ${sql(column)} = ${sql(column)} + 1, last_seen_at = now() where public_key = ${publicKey}`- .catch(() => {});+ // The `.catch()` alone was not enough to make it so. Building the query+ // THROWS synchronously when DATABASE_URL is absent (getSqlSafe raises+ // before any promise exists), so the throw escaped past the catch and out+ // of the un-awaited call into failJob's caller, 500-ing a result submission+ // over a counter nobody reads on that path. Guard the construction too.+ try {+ Promise.resolve(+ sql`update inference_nodes set ${sql(column)} = ${sql(column)} + 1, last_seen_at = now() where public_key = ${publicKey}`,+ ).catch(() => {});+ } catch { /* no database configured: the rollup is optional, the result is not */ }}diff --git a/api/nodes/jobs/[id]/result.js b/api/nodes/jobs/[id]/result.jsindex 72b9034e5..272747009 100644--- a/api/nodes/jobs/[id]/result.js+++ b/api/nodes/jobs/[id]/result.js@@ -17,7 +17,7 @@import { cors, error, json, method, readJson, wrap, rateLimited } from '../../../_lib/http.js';import { limits, clientIp } from '../../../_lib/rate-limit.js';-import { completeJob, failJob, verifyResultReceipt, verifyNodeSignature } from '../../../_lib/inference-nodes.js';+import { completeJob, failJob, getJob, verifyResultReceipt, verifyNodeSignature } from '../../../_lib/inference-nodes.js';const MAX_CLOCK_SKEW_MS = 5 * 60 * 1000;@@ -60,7 +60,6 @@ export default wrap(async (req, res) => {// Recompute the receipt from the submitted fields and verify it. The job's// claimed prompt/model come from the server's own record, so a node cannot// sign a receipt over a different prompt than it was assigned.- const { getJob } = await import('../../_lib/inference-nodes.js');const job = await getJob(jobId);if (!job) return error(res, 404, 'job_not_found', 'no such job');if (job.claimedBy !== node) return error(res, 403, 'not_job_owner', 'this node did not claim this job');