resuelto el problema, el post para crear customer creaba pero no emitia respuesta, se deja en 2 segundos y se usa un get por email para traer la data

This commit is contained in:
Lucas Tettamanti
2026-01-02 19:59:03 -03:00
parent 303c3daafe
commit 4de68dc996
8 changed files with 475 additions and 87 deletions

View File

@@ -11,6 +11,25 @@ import { makeSimSend } from "./src/controllers/sim.js";
import { makeEvolutionWebhook } from "./src/controllers/evolution.js";
import { makeGetConversationState } from "./src/controllers/conversationState.js";
async function configureUndiciDispatcher() {
// Node 18+ usa undici debajo de fetch. Esto suele arreglar timeouts “fantasma” por keep-alive/pooling.
// Nota: si el módulo `undici` no está disponible, no rompemos el arranque (solo logueamos warning).
try {
const { setGlobalDispatcher, Agent } = await import("undici");
setGlobalDispatcher(
new Agent({
connections: 10,
pipelining: 0,
keepAliveTimeout: 10_000,
keepAliveMaxTimeout: 10_000,
})
);
console.log("[http] undici global dispatcher configured");
} catch (e) {
console.warn("[http] undici dispatcher not configured:", e?.message || e);
}
}
const app = express();
app.use(cors());
app.use(express.json({ limit: "1mb" }));
@@ -73,6 +92,7 @@ app.get("/", (req, res) => {
const port = process.env.PORT || 3000;
(async function boot() {
await configureUndiciDispatcher();
TENANT_ID = await ensureTenant({ key: TENANT_KEY, name: TENANT_KEY.toUpperCase() });
app.listen(port, () => console.log(`UI: http://localhost:${port} (tenant=${TENANT_KEY})`));
})().catch((err) => {