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(forge): return after rateLimited() so handlers stop on 429

nirholas0a66cb9ba34c
diff --git a/api/forge-feedback.js b/api/forge-feedback.js
index bea0e926a..d5a538af8 100644
--- a/api/forge-feedback.js
+++ b/api/forge-feedback.js
@@ -26,7 +26,7 @@ export default wrap(async (req, res) => {
const rl = await limits.mcp3dStatus(clientIp(req));
if (!rl.success) {
- rateLimited(res, rl);
+ return rateLimited(res, rl);
}
if (!forgeStoreEnabled()) {
diff --git a/api/forge-gallery.js b/api/forge-gallery.js
index 92089c9f0..88bb59d0e 100644
--- a/api/forge-gallery.js
+++ b/api/forge-gallery.js
@@ -23,7 +23,7 @@ export default wrap(async (req, res) => {
const rl = await limits.mcp3dStatus(clientIp(req));
if (!rl.success) {
- rateLimited(res, rl);
+ return rateLimited(res, rl);
}
if (!forgeStoreEnabled()) {
diff --git a/api/forge-motion.js b/api/forge-motion.js
index b94209ede..cd7434c17 100644
--- a/api/forge-motion.js
+++ b/api/forge-motion.js
@@ -42,7 +42,7 @@ async function startJob(req, res) {
const ip = clientIp(req);
const rl = await limits.mcp3dGenerate(ip);
if (!rl.success) {
- rateLimited(res, rl);
+ return rateLimited(res, rl);
}
const body = await readJson(req, 4_000).catch(() => null);
@@ -87,7 +87,7 @@ async function pollJob(req, res, jobId) {
const rl = await limits.mcp3dStatus(clientIp(req));
if (!rl.success) {
- rateLimited(res, rl);
+ return rateLimited(res, rl);
}
let provider;
diff --git a/api/forge-rembg.js b/api/forge-rembg.js
index 81174c7f4..f0ccbee9f 100644
--- a/api/forge-rembg.js
+++ b/api/forge-rembg.js
@@ -33,7 +33,7 @@ async function startJob(req, res) {
const ip = clientIp(req);
const rl = await limits.mcp3dGenerate(ip);
if (!rl.success) {
- rateLimited(res, rl);
+ return rateLimited(res, rl);
}
const body = await readJson(req, 4_000).catch(() => null);
@@ -71,7 +71,7 @@ async function pollJob(req, res, jobId) {
const rl = await limits.mcp3dStatus(clientIp(req));
if (!rl.success) {
- rateLimited(res, rl);
+ return rateLimited(res, rl);
}
let provider;
diff --git a/api/forge-remesh.js b/api/forge-remesh.js
index 347467821..f165b98bf 100644
--- a/api/forge-remesh.js
+++ b/api/forge-remesh.js
@@ -39,7 +39,7 @@ async function startJob(req, res) {
const ip = clientIp(req);
const rl = await limits.mcp3dGenerate(ip);
if (!rl.success) {
- rateLimited(res, rl);
+ return rateLimited(res, rl);
}
const body = await readJson(req, 4_000).catch(() => null);
@@ -96,7 +96,7 @@ async function pollJob(req, res, jobId) {
const rl = await limits.mcp3dStatus(clientIp(req));
if (!rl.success) {
- rateLimited(res, rl);
+ return rateLimited(res, rl);
}
let provider;
diff --git a/api/forge-segment.js b/api/forge-segment.js
index 4ea0fb4fb..313284384 100644
--- a/api/forge-segment.js
+++ b/api/forge-segment.js
@@ -38,7 +38,7 @@ async function startJob(req, res) {
const ip = clientIp(req);
const rl = await limits.mcp3dGenerate(ip);
if (!rl.success) {
- rateLimited(res, rl);
+ return rateLimited(res, rl);
}
const body = await readJson(req, 4_000).catch(() => null);
@@ -94,7 +94,7 @@ async function pollJob(req, res, jobId) {
const rl = await limits.mcp3dStatus(clientIp(req));
if (!rl.success) {
- rateLimited(res, rl);
+ return rateLimited(res, rl);
}
let provider;
diff --git a/api/forge-stylize.js b/api/forge-stylize.js
index 50b8cd1a8..223b0e669 100644
--- a/api/forge-stylize.js
+++ b/api/forge-stylize.js
@@ -46,7 +46,7 @@ async function startJob(req, res) {
const ip = clientIp(req);
const rl = await limits.mcp3dGenerate(ip);
if (!rl.success) {
- rateLimited(res, rl);
+ return rateLimited(res, rl);
}
const body = await readJson(req, 4_000).catch(() => null);
@@ -97,7 +97,7 @@ async function pollJob(req, res, jobId) {
const rl = await limits.mcp3dStatus(clientIp(req));
if (!rl.success) {
- rateLimited(res, rl);
+ return rateLimited(res, rl);
}
let provider;
diff --git a/api/forge-upload.js b/api/forge-upload.js
index e103015b2..d54b78fdb 100644
--- a/api/forge-upload.js
+++ b/api/forge-upload.js
@@ -63,7 +63,7 @@ export default wrap(async (req, res) => {
const ip = clientIp(req);
const rl = await limits.upload(`forge:${ip}`);
if (!rl.success) {
- rateLimited(res, rl, 'Upload limit reached. Try again shortly.');
+ return rateLimited(res, rl, 'Upload limit reached. Try again shortly.');
}
const body = await readJson(req, 2_000).catch(() => null);
diff --git a/api/forge.js b/api/forge.js
index 11c819385..89be874e8 100644
--- a/api/forge.js
+++ b/api/forge.js
@@ -136,7 +136,7 @@ async function startJob(req, res) {
const ip = clientIp(req);
const rl = await limits.mcp3dGenerate(ip);
if (!rl.success) {
- rateLimited(res, rl, 'Generation limit reached. Try again shortly.');
+ return rateLimited(res, rl, 'Generation limit reached. Try again shortly.');
}
const body = await readJson(req, 8_000).catch(() => null);
@@ -404,7 +404,7 @@ async function startRigJob(req, res) {
const ip = clientIp(req);
const rl = await limits.mcp3dGenerate(ip);
if (!rl.success) {
- rateLimited(res, rl, 'Rigging limit reached. Try again shortly.');
+ return rateLimited(res, rl, 'Rigging limit reached. Try again shortly.');
}
const body = await readJson(req, 8_000).catch(() => null);
@@ -481,7 +481,7 @@ async function pollJob(req, res, jobId) {
const rl = await limits.mcp3dStatus(clientIp(req));
if (!rl.success) {
- rateLimited(res, rl);
+ return rateLimited(res, rl);
}
const provider = token?.provider || 'replicate';
diff --git a/api/x402-pay.js b/api/x402-pay.js
index a757538bc..8acf16fa9 100644
--- a/api/x402-pay.js
+++ b/api/x402-pay.js
@@ -571,7 +571,7 @@ export default wrap(async (req, res) => {
const ip = clientIp(req);
const ipRl = await limits.x402PayIp(ip);
if (!ipRl.success) {
- rateLimited(res, ipRl);
+ return rateLimited(res, ipRl);
}
const globalRl = await limits.x402PayGlobal();
if (!globalRl.success) {