bridge.mjs
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf
mirror: GitHub Phase A durable MCP OAuth (#270)
Human
minor
⚠ breaking
12 days ago
| 1 | /** |
| 2 | * Netlify serverless wrapper for the Knowtation Hub Bridge. |
| 3 | * Use this when you deploy the bridge as a second Netlify site (same repo, redirect to this function). |
| 4 | * Set the bridge env vars in that site's dashboard; set BRIDGE_URL on the gateway to that site's URL. |
| 5 | * Attaches Netlify Blob store for persistent tokens + vector DBs. |
| 6 | */ |
| 7 | import serverless from 'serverless-http'; |
| 8 | import { connectLambda, getStore } from '@netlify/blobs'; |
| 9 | import { app } from '../../hub/bridge/server.mjs'; |
| 10 | |
| 11 | export const handler = async (event, context) => { |
| 12 | connectLambda(event); |
| 13 | // Default `eventual` (fast) for the store handle. Calendar OAuth hydrate still passes |
| 14 | // `consistency: 'strong'` per get (see hub/bridge/calendar-blob-store.mjs) so begin→callback |
| 15 | // read-after-write does not return state_invalid. Set NETLIFY_BLOBS_CONSISTENCY=strong on the |
| 16 | // **bridge** site to also force strong for index/vector reads; see Netlify Blobs docs. |
| 17 | const consistency = |
| 18 | String(process.env.NETLIFY_BLOBS_CONSISTENCY || '') |
| 19 | .trim() |
| 20 | .toLowerCase() === 'strong' |
| 21 | ? 'strong' |
| 22 | : 'eventual'; |
| 23 | globalThis.__netlify_blob_store = getStore({ name: 'bridge-data', consistency }); |
| 24 | try { |
| 25 | return await serverless(app)(event, context); |
| 26 | } finally { |
| 27 | delete globalThis.__netlify_blob_store; |
| 28 | } |
| 29 | }; |
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
sha256:6a102aafafdfe7e70a24f4e59740200f0ee713ce7915f1b53e9d4ba5ee8b4410
Initial Muse snapshot
Human
84 days ago