# Knowtation: gateway runs as a Netlify serverless function; static site is on 4Everland. [build] command = "npm install && node scripts/netlify-redirects.mjs && cd hub/gateway && npm ci && cd ../bridge && npm ci" functions = "netlify/functions" publish = "public" [build.environment] NODE_VERSION = "20" # sqlite-vec uses `new URL('.', import.meta.url)` to find vec0.{so,dylib,dll}. Esbuild bundling # breaks import.meta.url → TypeError Invalid URL (input '.'). Keep these external so Node loads # real package files from node_modules (see sqlite-vec index.mjs getLoadablePath). # stripe is external + lazy-loaded in billing-stripe.mjs to avoid bundling ~220 KB on cold start. [functions] node_bundler = "esbuild" external_node_modules = [ "better-sqlite3", "sqlite-vec", "sqlite-vec-linux-x64", "sqlite-vec-linux-arm64", "sqlite-vec-darwin-x64", "sqlite-vec-darwin-arm64", "sqlite-vec-windows-x64", "stripe" ] # exceljs is large; bundling it in esbuild for netlify/functions/bridge.mjs can fail Netlify # (opaque exit 1, sometimes with @netlify/build TypeError in error formatting). Keep it # external for the bridge function only so gateway.zip does not add node_modules/exceljs. [functions."bridge"] external_node_modules = ["exceljs"] # Netlify sync-function platform max is 60 s per docs.netlify.com/build/functions/overview. # Per-function timeout must be a sub-table; a scalar `timeout = N` under [functions] is # rejected by the config validator. Gateway raised from 26 → 60 to give the bridge-proxy # index call (POST /api/v1/index) headroom under the DeepInfra (BAAI/bge-large-en-v1.5) # embedding latency profile, which can run 2× the OpenAI text-embedding-3-small wall # time for the same vault. See `hub/bridge/index-timing.mjs` and the timing logs # (`type:knowtation_index_step`) in bridge logs to identify which sub-step dominates # before deciding on a parallelize/async fix. [functions."gateway"] timeout = 60 [functions."warmup"] timeout = 26 # Scheduled function: runs hourly, triggers consolidation for all due hosted users. # Netlify scheduled functions run as background-style invocations (up to 15 min); # 26 s is the declared limit here for safety — tune MAX_USERS_PER_RUN if needed. [functions."consolidation-scheduler"] timeout = 26 # Catch-all routing lives in public/_redirects (scripts/netlify-redirects.mjs). Do not add # [[redirects]] here: in a monorepo, root netlify.toml settings apply to every linked site # and would send the bridge deploy to the gateway function.