Difficulty Setting up with NextJS
super excited about the launch on vercel! however
I keep getting the following errors when I try to launch on localhost:
I'm following the NextJS setup guide. https://www.rivet.dev/docs/actors/quickstart/next-js/
this is my setup:
when I access http://localhost:3000/api/rivet/actors?namespace=default
I get
Not Found (RivetKit)
but when I access /metadata I get
I'm using turborepo if that matters.17 Replies
afk rn, will take a look in a couple hours
@sylvester stallone thanks for reaching out and reporting the issue
what OS are you running on?
can you try running with debug logs by using the LOG_LEVEL env var, like this:
then send the output?
it'd be really helpful if you can try cloning our template to see if that works on your machine too to rule out configuration issues – https://github.com/rivet-dev/template-vercel
GitHub
GitHub - rivet-dev/template-vercel: Next.js template with RivetKit ...
Next.js template with RivetKit integration for Vercel deployment - rivet-dev/template-vercel
macos
i’ll hop on in a few to see if i can help figure this out, lmk when you can send the debug logs
this is if I connect to a custom nodejs server
note that even though it connects the counter doesn't work
here are the logs when I try to run it on nextjs setup (with api/all/rivet) etc
this is the setup
cc @Nathan
looking in to this, thx!
spent a bit trying to reproduce this.
- i just cut a release for RivetKit 2.0.19, can you try running this version?
- if the error persists, can you try running
"/Users/sasha/Library/Application Support/rivetkit/web-644b5f37/bin/rivet-engine-25.8.1" start in your terminal and see what it says?after upgrade: OPTIONS /api/rivet/actors?namespace=default 404 in 33ms
level=WARN msg="engine process exited, please report this error" code= signal=SIGKILL issues=https://github.com/rivet-dev/rivetkit/issues support=https://rivet.dev/discord
PUT /api/inngest 200 in 123ms
Error: engine health check failed after 100 retries: TypeError: fetch failed
at waitForEngineHealth (webpack-internal:///(rsc)/../../node_modules/rivetkit/dist/tsup/chunk-L3YPHXPE.js:3040:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ensureEngineProcess (webpack-internal:///(rsc)/../../node_modules/rivetkit/dist/tsup/chunk-L3YPHXPE.js:2870:3)
at async Promise.all (index 0)
⨯ unhandledRejection: Error: engine health check failed after 100 retries: TypeError: fetch failed
at waitForEngineHealth (webpack-internal:///(rsc)/../../node_modules/rivetkit/dist/tsup/chunk-L3YPHXPE.js:3040:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ensureEngineProcess (webpack-internal:///(rsc)/../../node_modules/rivetkit/dist/tsup/chunk-L3YPHXPE.js:2870:3)
at async Promise.all (index 0)
⨯ unhandledRejection: Error: engine health check failed after 100 retries: TypeError: fetch failed
at waitForEngineHealth (webpack-internal:///(rsc)/../../node_modules/rivetkit/dist/tsup/chunk-L3YPHXPE.js:3040:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ensureEngineProcess (webpack-internal:///(rsc)/../../node_modules/rivetkit/dist/tsup/chunk-L3YPHXPE.js:2870:3)
at async Promise.all (index 0)
Discord
Join the Rivet Developer Network Discord Server!
Build and scale stateful workloads. Rivet is a library for long-lived processes with durable state, realtime, and scalability. Easily self-hostable and works with your infrastructure. | 1386 members
can you try removing that file (
rm "/Users/sasha/Library/Application Support/rivetkit/web-644b5f37/bin/rivet-engine-25.8.1") then starting the dev server again?OPTIONS /api/rivet/actors?namespace=default 404 in 23ms
OPTIONS /api/rivet/actors?namespace=default 404 in 28ms
OPTIONS /api/rivet/actors?namespace=default 404 in 74ms
OPTIONS /api/rivet/actors?namespace=default 404 in 13ms
PUT /api/inngest 200 in 330ms
OPTIONS /api/rivet/actors?namespace=default 404 in 12ms
level=WARN msg="engine binary download is taking longer than expected, please be patient" version=25.8.1
OPTIONS /api/rivet/actors?namespace=default 404 in 22ms
GET /api/rivet/metadata 200 in 10ms
PUT /api/inngest 200 in 38ms
OPTIONS /api/rivet/actors?namespace=default 404 in 24ms
PUT /api/inngest 200 in 36ms
OPTIONS /api/rivet/actors?namespace=default 404 in 32ms
PUT /api/inngest 200 in 47ms
PUT /api/inngest 200 in 44ms
PUT /api/inngest 200 in 42ms
PUT /api/inngest 200 in 53ms
OPTIONS /api/rivet/actors?namespace=default 404 in 52ms
looks like it's going in the right direction. can you run this again with
LOG_LEVEL=debug?
the 404 on /api/rivet/actors looks like there might be a configuration issue on your client. can you send how your calling createRivetKit? you should see a request to GET /metadata before anything else'use client';
import { useState } from 'react';
import { createRivetKit } from '@rivetkit/react';
import type { registry } from '@hou/ai/src/rivet/registry';
const { useActor } = createRivetKit<typeof registry>(
'http://localhost:3000/api/rivet',
);
export function Counter() {
const [count, setCount] = useState(0);
const counter = useActor({
name: 'counter',
key: ['test'],
});
counter.useEvent('newCount', (x: number) => setCount(x));
const increment = async () => {
await counter.connection?.increment(1);
};
return (
<div>
<p>Count: {count}</p>
<button onClick={increment}>Increment</button>
</div>
);
}
thgis is where I'm calling
same code as the one in here: https://www.rivet.dev/docs/actors/quickstart/next-js/
it looks like i fixed the original issue
but you should be seeing a request to
GET /api/rivet/metadata that's not getting sent. can you check your browser's request log for this?
updating your import to:
and verify that both @Rivetkit/next-js and rivetkit are on v2.0.20?