Cloudflare Durable Objects

I am looking to deploy a simple solidstart app on cloudflare with bindings for durable objects. There are a few github issues from 2023 but they seem to be pretty out of date. Has anyone implemented this successfully? Here is the error I am getting when I try to deploy:
✘ [ERROR] Your Worker depends on the following Durable Objects, which are not exported in your entrypoint file: Counter.

You should export these objects from your entrypoint,
.output/server/index.mjs.
✘ [ERROR] Your Worker depends on the following Durable Objects, which are not exported in your entrypoint file: Counter.

You should export these objects from your entrypoint,
.output/server/index.mjs.
My solidstart config looks like this:
export default defineConfig({
vite: ...,

ssr: true,

server: {
preset: "cloudflare_module",
compatibilityDate: "2025-09-05",

cloudflare: {
deployConfig: true,
nodeCompat: true,
wrangler: {
name: "peregrine",
observability: {
enabled: true
},
assets: {
binding: "ASSETS",
directory: ".output/public"
},
durable_objects: {
bindings: [{
name: "COUNTER",
class_name: "Counter"
}],
},
migrations: [
{ tag: "v1", new_sqlite_classes: ["Counter"] }
]
}
},

rollupConfig: {
external: ["__STATIC_CONTENT_MANIFEST", "node:async_hooks"],
},
}
});
export default defineConfig({
vite: ...,

ssr: true,

server: {
preset: "cloudflare_module",
compatibilityDate: "2025-09-05",

cloudflare: {
deployConfig: true,
nodeCompat: true,
wrangler: {
name: "peregrine",
observability: {
enabled: true
},
assets: {
binding: "ASSETS",
directory: ".output/public"
},
durable_objects: {
bindings: [{
name: "COUNTER",
class_name: "Counter"
}],
},
migrations: [
{ tag: "v1", new_sqlite_classes: ["Counter"] }
]
}
},

rollupConfig: {
external: ["__STATIC_CONTENT_MANIFEST", "node:async_hooks"],
},
}
});
and my entry-server.tsx file looks like this:
// @refresh reload
import { createHandler, StartServer } from "@solidjs/start/server";

export default createHandler(() => (
<StartServer
...
/>
));

// Export Durable Object classes
export { Counter } from './durable-objects/Counter';
// @refresh reload
import { createHandler, StartServer } from "@solidjs/start/server";

export default createHandler(() => (
<StartServer
...
/>
));

// Export Durable Object classes
export { Counter } from './durable-objects/Counter';
3 Replies
snoww
snoww3mo ago
i haven't tried this with solidstart, only tanstack start. but what i did was create two workers, one for start, and one for the do. then i used the cloudflare vite plugin to start up both at the same time and have integration. https://developers.cloudflare.com/workers/vite-plugin/
Cloudflare Docs
Vite plugin
A full-featured integration between Vite and the Workers runtime
alexmarmon
alexmarmonOP3mo ago
great idea thank you
dylanj
dylanj3mo ago
Hey @alexmarmon, I'm attempting the same thing at the moment and got it working with just
name = "deep-space-derby"
main = ".output/server/index.mjs"

[durable_objects]
bindings = [
{ name = "GAME", class_name = "$DurableObject" }
]
name = "deep-space-derby"
main = ".output/server/index.mjs"

[durable_objects]
bindings = [
{ name = "GAME", class_name = "$DurableObject" }
]
export default defineConfig({
server: {
preset: "cloudflare-durable",
},
});
export default defineConfig({
server: {
preset: "cloudflare-durable",
},
});
in the app config and then forwarding requests to the durable object in the server function
if (!cloudflare.durable) {
const binding = cloudflare.env.GAME;
const id = binding.idFromName(gameId);

return (await binding.get(id).fetch(event.request)) as number;
}
if (!cloudflare.durable) {
const binding = cloudflare.env.GAME;
const id = binding.idFromName(gameId);

return (await binding.get(id).fetch(event.request)) as number;
}
However this doesn't work if the server function is invoked during SSR as the request will be for the page being rendered and not the server function invocation which I've asked a question about here The cloudflare-durable preset does inject a helper function durableFetch into the context for forwarding requests to the durable object, but it hard codes the object name for some reason. I guess whoever wrote it only needed a single durable object which IMO kinda defeats the purpose

Did you find this page helpful?