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: update zauth middleware import and error logging for better clarity

nirholascf7315ecbf8d
diff --git a/api/_lib/zauth.js b/api/_lib/zauth.js
index 2982b5529..14a941345 100644
--- a/api/_lib/zauth.js
+++ b/api/_lib/zauth.js
@@ -8,26 +8,24 @@
//
// Disabled cleanly when ZAUTH_API_KEY is unset — `instrument()` becomes a
// no-op so unrelated environments don't pay any cost.
+//
+// Static import (not createRequire) so Vercel's @vercel/nft traces the
+// `./middleware` subpath and bundles it into the deployment.
-import { createRequire } from 'node:module';
+import { zauthProvider } from '@zauthx402/sdk/middleware';
import { env } from './env.js';
-const require = createRequire(import.meta.url);
-
let cached;
function buildMiddleware() {
const apiKey = env.ZAUTH_API_KEY;
if (!apiKey) return null;
try {
- // Lazy require so deployments without the SDK installed (or without a
- // key) don't pay the import cost.
- const mod = require('@zauthx402/sdk/middleware');
- return mod.zauthProvider(apiKey, {
+ return zauthProvider(apiKey, {
shouldMonitor: shouldMonitorReq,
});
} catch (err) {
- console.error('[zauth] failed to load @zauthx402/sdk:', err.message);
+ console.error('[zauth] failed to build middleware:', err.message);
return null;
}
}