Error with "getOrCreate"

Getting the following when trying to call "getOrCreate" from my client. This happens both when trying to access via "useActor" hook and manually calling the method. When i create the actor in the studio and then call getForId then the client resolves to the right actor and I can call actions successfully Not sure how to properly debug?
3246 | });
3247 | router.openapi(route, async (c) => {
3248 | const body = c.req.valid("json");
3249 | const existingActor = await managerDriver.getWithKey({
3250 | c,
3251 | name: body.name,
^
TypeError: undefined is not an object (evaluating 'body.name')
at <anonymous> (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/rivetkit/dist/tsup/chunk-E77RVI3P.js:3251:15)
at <anonymous> (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/rivetkit/dist/tsup/chunk-E77RVI3P.js:3247:34)
at dispatch (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/hono/dist/compose.js:22:23)
at dispatch (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/hono/dist/compose.js:6:32)
at dispatch (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/hono/dist/compose.js:22:23)
at dispatch (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/hono/dist/compose.js:6:32)
at handleHttpGateway (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/rivetkit/dist/tsup/chunk-E77RVI3P.js:2906:34)
at actorGateway (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/rivetkit/dist/tsup/chunk-E77RVI3P.js:2845:16)
at actorGateway (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/rivetkit/dist/tsup/chunk-E77RVI3P.js:2838:29)
at dispatch (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/hono/dist/compose.js:22:23)
3246 | });
3247 | router.openapi(route, async (c) => {
3248 | const body = c.req.valid("json");
3249 | const existingActor = await managerDriver.getWithKey({
3250 | c,
3251 | name: body.name,
^
TypeError: undefined is not an object (evaluating 'body.name')
at <anonymous> (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/rivetkit/dist/tsup/chunk-E77RVI3P.js:3251:15)
at <anonymous> (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/rivetkit/dist/tsup/chunk-E77RVI3P.js:3247:34)
at dispatch (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/hono/dist/compose.js:22:23)
at dispatch (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/hono/dist/compose.js:6:32)
at dispatch (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/hono/dist/compose.js:22:23)
at dispatch (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/hono/dist/compose.js:6:32)
at handleHttpGateway (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/rivetkit/dist/tsup/chunk-E77RVI3P.js:2906:34)
at actorGateway (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/rivetkit/dist/tsup/chunk-E77RVI3P.js:2845:16)
at actorGateway (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/rivetkit/dist/tsup/chunk-E77RVI3P.js:2838:29)
at dispatch (/Users/garrett/Documents/github/experiments/rivet-chat/node_modules/hono/dist/compose.js:22:23)
13 Replies
garrett
garrettOP3mo ago
can confirm this http request is also failing
curl -X PUT 'http://127.0.0.1:6420/actors?namespace=default' \
-H 'Content-Type: application/json' \
-d '{
"name": "chatManifest",
"key": "singleton",
"runner_name_selector": "rivetkit",
"crash_policy": "sleep"
}'
curl -X PUT 'http://127.0.0.1:6420/actors?namespace=default' \
-H 'Content-Type: application/json' \
-d '{
"name": "chatManifest",
"key": "singleton",
"runner_name_selector": "rivetkit",
"crash_policy": "sleep"
}'
this is what I intercepted that my app was making failing on 2.0.7 and 2.0.8
Nathan
Nathan3mo ago
looking in to this
garrett
garrettOP3mo ago
Just for some context, I am trying to do this from a cli application. I am running the server with bun and hono
garrett
garrettOP3mo ago
I made a local copy of this example and it seems to run fine from the cli script and the browser https://github.com/rivet-dev/rivetkit/tree/main/examples/chat-room
GitHub
rivetkit/examples/chat-room at main · rivet-dev/rivetkit
A library for building stateful workloads anywhere - rivet-dev/rivetkit
garrett
garrettOP3mo ago
Here is what I am working on. let me know if you need help setting it up https://github.com/ghardin1314/rivet-chat
GitHub
GitHub - ghardin1314/rivet-chat
Contribute to ghardin1314/rivet-chat development by creating an account on GitHub.
garrett
garrettOP3mo ago
Ok tracked this down to the @hono/zod-openapi middleware is not working properly. The c.req.valid("json") is returning undefined because it appears the zod openapi validation step is not running. the c.req.json() method returns the valid request body and if I use that instead then the route runs successfully Not sure if this is a code probably or some kind of weird dependency issue trying to use bun as a package manager in a monorepo. I have had weird things happen to me before trying this. I will investigate this more later when i have time Confirmed this was a bun module resolution issue. Works fine once I switched to pnpm
Nathan
Nathan3mo ago
roger, i'll track that down. thx! i wish that bun would just work, it breaks every couple versions. we prob just need to add bun + vitest to ci.
garrett
garrettOP3mo ago
yeah me too. the premise of it sounds so good but I always end up disappointed.
Nathan
Nathan3mo ago
just cloned the project to try to reproduce, damn this is cool couldn't seem to get past the drizzle migration step on master for your branch, can't seem to reproduce getOrCreate in bun on my end. will try the curl req in a sec.
Nathan
Nathan3mo ago
is this what you were seeing? i'm using 1.2.2
No description
garrett
garrettOP3mo ago
thats what it was looking when it works. Honestly I dont think its worth looking into more as it should be fixed on Bun's end in the next release
garrett
garrettOP3mo ago
Bun (@bunjavascript)
@PolymathicEng @nhielsalvana Yes and we’re changing it to the default in 1.3 but have a couple more things to iron out first
X
Nathan
Nathan3mo ago
roger thx

Did you find this page helpful?