No such Durable Object class is exported from the worker

Hey there, I am currently trying to setup OpenNext to work with a durable object, but I can't seem to get it to work. I always get this error message:
A DurableObjectNamespace in the config referenced the class "DatabaseDurableObject", but no such Durable Object class is exported from the worker. Please make sure the class name matches, it is exported, and the class extends 'DurableObject'. Attempts to call to this Durable Object class will fail at runtime, but historically this was not a startup-time error. Future versions of workerd may make this a startup-time error.
A DurableObjectNamespace in the config referenced the class "DatabaseDurableObject", but no such Durable Object class is exported from the worker. Please make sure the class name matches, it is exported, and the class extends 'DurableObject'. Attempts to call to this Durable Object class will fail at runtime, but historically this was not a startup-time error. Future versions of workerd may make this a startup-time error.
I am of course exporting it from my worker entry file (in this case worker.ts). What am I doing wrong here? The OpenNext documentation suggests that I should be able to do this.
import { default as handler } from "../.open-next/worker.js";
import { DatabaseDurableObject } from "../src/core/db-do";

export default {
fetch: handler.fetch,
} satisfies ExportedHandler<CloudflareEnv>;

export { DatabaseDurableObject };
import { default as handler } from "../.open-next/worker.js";
import { DatabaseDurableObject } from "../src/core/db-do";

export default {
fetch: handler.fetch,
} satisfies ExportedHandler<CloudflareEnv>;

export { DatabaseDurableObject };
1 Reply
tanabata
tanabata3mo ago
I think that this is a known issue. https://opennext.js.org/cloudflare/known-issues
Known Issues - OpenNext
Open-source Next.js adapters

Did you find this page helpful?