Se añade un event listener que loggea cuando se va a apagar la función
Deploy Function / deploy (push) Successful in 22s
Deploy Migrations to Production / deploy (push) Successful in 11s

This commit is contained in:
2026-02-19 13:06:34 -06:00
parent a028fd459f
commit 38e1488c8c
4 changed files with 28 additions and 0 deletions
@@ -19,6 +19,13 @@ type NivelType =
type TipoCicloType =
Database["public"]["Tables"]["planes_estudio"]["Insert"]["tipo_ciclo"];
addEventListener("beforeunload", (ev: any) => {
// ev.detail.reason te dirá si es "timeout", "memory_limit" o "idle"
console.error("ALERTA: La función se va a apagar. Razón:", ev.detail?.reason);
// Aquí puedes intentar un último log antes de que todo muera
});
Deno.serve(async (req: Request): Promise<Response> => {
const url = new URL(req.url);
const functionName = url.pathname.split("/").pop();
@@ -9,6 +9,13 @@ import {
type StructuredResponseOptions,
} from "../_shared/openai-service.ts";
addEventListener("beforeunload", (ev: any) => {
console.error(
"ALERTA: La función se va a apagar. Razón:",
ev?.detail?.reason,
);
});
/**
* JSON input signature (when `Content-Type: application/json`)
*
@@ -22,6 +22,13 @@ type AddMessageBody = {
const app = new Hono();
addEventListener("beforeunload", (ev: any) => {
console.error(
"ALERTA: La función se va a apagar. Razón:",
ev?.detail?.reason,
);
});
// Preflight CORS
app.options(
"*",
@@ -10,6 +10,13 @@ import {
type StructuredResponseOptions,
} from "../_shared/openai-service.ts";
addEventListener("beforeunload", (ev: any) => {
console.error(
"ALERTA: La función se va a apagar. Razón:",
ev?.detail?.reason,
);
});
export type DataAsignaturaSugerida = {
nombre: Tables<"asignaturas">["nombre"];
codigo?: Tables<"asignaturas">["codigo"];