I am trying to make a Cloudflare Pages site using Durable Objects. I have a class Mask
defined in ./durable_objects/Mask.ts
. It only implements the basic constructor.
In wrangler.toml I have
[durable_objects]
bindings = [{ name = "MASK", class_name = "Mask" }]
[[migrations]]
tag = "v1"
new_classes = ["Mask"]
When I try to run the site locally with wrangler pages dev
I get the following error.
service core:user:worker: Uncaught TypeError: Class extends value undefined is not a constructor or null
at functionsWorker-0.9520352929258784.js:684:44 in maskDurableObjectDefinition
at functionsWorker-0.9520352929258784.js:693:13
✘ [ERROR] MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
Adding the --experimental-json-config
I get the same error, if add --do MASK=Mask
I get an error which boils down to The symbol "Mask" has already been declared
So how do I properly declare and use a durable object with Cloudflare Pages?