Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/core/src/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,13 @@ export function Nextlytics(userConfig: NextlyticsConfig): NextlyticsResult {
userContext,
properties: { ...propsFromCallback, ...opts?.props },
};
await dispatchEventInternal(event, ctx);
// Await full delivery, not just dispatch kickoff. Unlike the middleware
// page-view path (which defers `completion` with `after()`), an explicit
// sendEvent has no response to ride on — in a serverless function the
// process can freeze right after this returns, dropping in-flight backend
// writes. Awaiting `completion` makes `await sendEvent()` mean "delivered".
const { completion } = dispatchEventInternal(event, ctx);
await completion;

return { ok: true };
},
Expand Down
Loading