warmup.mjs
22 lines 849 B
Raw
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf mirror: GitHub Phase A durable MCP OAuth (#270) Human minor ⚠ breaking 12 days ago
1 /**
2 * Scheduled function: pings the gateway Lambda every 5 minutes to prevent cold starts.
3 * Cold-starting the 1.8 MB gateway bundle takes 12+ seconds on Netlify, which exceeds
4 * browser TLS-handshake timeouts and causes ERR_CONNECTION_CLOSED / ERR_TIMED_OUT.
5 * This keeps the Lambda warm so real user requests always hit a hot instance.
6 */
7 export default async () => {
8 const siteUrl = process.env.URL || 'https://knowtation-gateway.netlify.app';
9 try {
10 const res = await fetch(`${siteUrl}/api/v1/auth/providers`, {
11 signal: AbortSignal.timeout(20000),
12 });
13 console.log('[warmup] gateway responded:', res.status);
14 } catch (e) {
15 console.log('[warmup] gateway ping failed (expected on first cold start):', e?.message || String(e));
16 }
17 return new Response('ok');
18 };
19
20 export const config = {
21 schedule: '* * * * *',
22 };
File History 4 commits
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf mirror: GitHub Phase A durable MCP OAuth (#270) Human minor 12 days ago
sha256:d8c648b20a4d53b2673c5c082ee7edfa7b2fc9b11080832da1f38807b6bf940b fix(7C-L1b): route hosted delegation proposals through cani… Human minor 32 days ago
sha256:2827ba9e7632a4b141c50caf1e8f7d77abbc3515be20e7465f2bccb0ac4edf91 fix: repair endpoint now sets has_active_subscription when … Human minor 51 days ago