Skip to content

Commit 4966b21

Browse files
committed
feat: US-017 - Remove Buffer from shared actor runtime glue
1 parent cace66b commit 4966b21

6 files changed

Lines changed: 193 additions & 85 deletions

File tree

rivetkit-typescript/CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- Select runtime behavior from `CoreRuntime.kind`, not `instanceof` adapter classes; NAPI maps to the native runtime kind and wasm maps to wasm.
1818
- Keep `CoreRuntime` SQL methods on the portable `RuntimeSql*` structs from `packages/rivetkit/src/registry/runtime.ts`; NAPI-only `Buffer` conversion belongs inside `NapiCoreRuntime`.
1919
- Keep `CoreRuntime` byte payloads on `RuntimeBytes`/`Uint8Array`; NAPI-only `Buffer` conversion belongs inside `NapiCoreRuntime`.
20+
- Shared actor glue in `packages/rivetkit/src/registry/native.ts` should construct `RuntimeBytes`/`Uint8Array`; leave `Buffer` creation to `NapiCoreRuntime`.
2021
- Wasm bindings for NAPI-supported runtime APIs should forward to `rivetkit-core`; avoid placeholder returns that break runtime parity.
2122
- Use public `sqlite` config for runtime SQLite backend selection; wasm defaults unset SQLite to remote and must reject local before runtime construction.
2223

rivetkit-typescript/packages/rivetkit/src/common/utils.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Next } from "hono";
22
import type { ContentfulStatusCode } from "hono/utils/http-status";
33
import * as errors from "@/actor/errors";
4-
import { EXTRA_ERROR_LOG, VERSION } from "@/utils";
4+
import { EXTRA_ERROR_LOG } from "@/utils";
55
import { getLogErrorStack } from "@/utils/env-vars";
66
import type { Logger } from "./log";
77

@@ -345,7 +345,13 @@ export function deconstructError(
345345
export function stringifyError(error: unknown): string {
346346
if (error instanceof Error) {
347347
if (typeof process !== "undefined" && getLogErrorStack()) {
348-
return `${error.name}: ${error.message}${error.stack ? `\n${error.stack}` : ""}`;
348+
let stack: string | undefined;
349+
try {
350+
stack = error.stack;
351+
} catch {
352+
stack = undefined;
353+
}
354+
return `${error.name}: ${error.message}${stack ? `\n${stack}` : ""}`;
349355
} else {
350356
return `${error.name}: ${error.message}`;
351357
}

0 commit comments

Comments
 (0)