bridge.mjs
29 lines 1.3 KB
Raw
sha256:c2dbf04d56308f3bbf2d06e6d2eb022b8948b1e827195fe525a44e5e18d5f9c0 feat(auth): Phase B Connect cloud agent (RFC 8628) + Hermes… Human minor ⚠ breaking 11 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 1 commit
sha256:93bcf8f9bd56d8c5b9339f4ec73b9ebd66571398d56262d38eedc2cfa9db9882 fix(test): align Band B landing assertion with desktop MCP … Human 11 days ago