Conversation
|
🚅 Deployed to the rivet-pr-4018 environment in rivet-frontend
|
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
PR Review: Split Node & Browser EntrypointsOverviewThis PR refactors RivetKit to properly separate Node.js and browser/edge runtime entrypoints through conditional exports. It adds a new Convex integration package and improves runtime compatibility. Overall, the changes are well-architected and follow good patterns for multi-platform support. ✅ Strengths1. Clean Dependency Injection PatternThe new
2. Proper Package.json Conditional ExportsThe package.json exports configuration correctly routes Node.js vs browser imports: "node": {
"import": "./dist/tsup/node-entry.js",
"require": "./dist/tsup/node-entry.cjs"
},
"browser": {
"default": "./dist/tsup/mod.js"
}3. Polyfill StrategyThe 4. WebSocket Runtime Detection
|
3dd9d16 to
c45986d
Compare
More templates
@rivetkit/cloudflare-workers
@rivetkit/convex
@rivetkit/db
@rivetkit/framework-base
@rivetkit/next-js
@rivetkit/react
rivetkit
@rivetkit/sql-loader
@rivetkit/virtual-websocket
@rivetkit/engine-runner
@rivetkit/engine-runner-protocol
commit: |
c45986d to
e320385
Compare
| const response = await registry.handler(request); | ||
|
|
||
| // For SSE endpoints like /start, keep the connection alive | ||
| const url = new URL(args.url); | ||
| if (url.pathname.endsWith("/start")) { | ||
| // Keep the action running to maintain WebSocket connection | ||
| // The SSE stream never completes, so we wait indefinitely | ||
| await new Promise(() => {}); | ||
| } | ||
|
|
||
| // Convert response to serializable format | ||
| const responseBody = await response.text(); | ||
| const responseHeaders: Record<string, string> = {}; | ||
| response.headers.forEach((value, key) => { | ||
| responseHeaders[key] = value; | ||
| }); | ||
|
|
||
| return { | ||
| status: response.status, | ||
| statusText: response.statusText, | ||
| headers: responseHeaders, | ||
| body: responseBody, | ||
| }; |
There was a problem hiding this comment.
Critical bug: unreachable code after infinite await. When the pathname ends with /start, the code awaits new Promise(() => {}) on line 75, which never resolves. This causes the function to hang until timeout, and the response serialization code (lines 79-90) will never execute.
The response object is created on line 68 but never returned for /start endpoints. Either:
- Remove the infinite await and return the response immediately, or
- Move the response serialization before the conditional check
// Handle request
const response = await registry.handler(request);
// Convert response to serializable format BEFORE the check
const responseBody = await response.text();
const responseHeaders: Record<string, string> = {};
response.headers.forEach((value, key) => {
responseHeaders[key] = value;
});
const serialized = {
status: response.status,
statusText: response.statusText,
headers: responseHeaders,
body: responseBody,
};
// For SSE endpoints like /start, keep the connection alive
const url = new URL(args.url);
if (url.pathname.endsWith("/start")) {
await new Promise(() => {});
}
return serialized;| const response = await registry.handler(request); | |
| // For SSE endpoints like /start, keep the connection alive | |
| const url = new URL(args.url); | |
| if (url.pathname.endsWith("/start")) { | |
| // Keep the action running to maintain WebSocket connection | |
| // The SSE stream never completes, so we wait indefinitely | |
| await new Promise(() => {}); | |
| } | |
| // Convert response to serializable format | |
| const responseBody = await response.text(); | |
| const responseHeaders: Record<string, string> = {}; | |
| response.headers.forEach((value, key) => { | |
| responseHeaders[key] = value; | |
| }); | |
| return { | |
| status: response.status, | |
| statusText: response.statusText, | |
| headers: responseHeaders, | |
| body: responseBody, | |
| }; | |
| const response = await registry.handler(request); | |
| // Convert response to serializable format | |
| const responseBody = await response.text(); | |
| const responseHeaders: Record<string, string> = {}; | |
| response.headers.forEach((value, key) => { | |
| responseHeaders[key] = value; | |
| }); | |
| const serialized = { | |
| status: response.status, | |
| statusText: response.statusText, | |
| headers: responseHeaders, | |
| body: responseBody, | |
| }; | |
| // For SSE endpoints like /start, keep the connection alive | |
| const url = new URL(args.url); | |
| if (url.pathname.endsWith("/start")) { | |
| // Keep the action running to maintain WebSocket connection | |
| // The SSE stream never completes, so we wait indefinitely | |
| await new Promise(() => {}); | |
| } | |
| return serialized; |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.

No description provided.