OK I have read through the last three

OK, I have read through the last three months of discord and searched, and am still coming up empty. I am using itty-router-openapi to serve paths. I have only been getting KV pairs and that seems to work just fine in my worker. I would like to get a Durable Object called User:
durable_objects.bindings = [
{ name = "USER", class_name = "User" }
]

[[migrations]]
tag = "v2"
new_classes = ["User"]
durable_objects.bindings = [
{ name = "USER", class_name = "User" }
]

[[migrations]]
tag = "v2"
new_classes = ["User"]
My routing code is in a file called "index.mts" where the User Object itself is stored in the following path: /paths/Durables/User I have imported the User Object in to index.mts: import {User} from "./paths/Durables/User"; I have exported that same file from the same piece of code: export {User} from "./paths/Durables/User" I have exported the class from the file itself: export default class User extends createDurable({ autoReturn: true }) { I keep getting the same error: Cannot create binding for class User that is not exported by the script
7 Replies
Paul Shriner
Paul ShrinerOP15mo ago
Worth noting, when I start wrangler dev, I get the following error: service core:user:worker: Uncaught ReferenceError: src_exports is not defined
Hello, I’m Allie!
Do you have a repo I can check out?
Paul Shriner
Paul ShrinerOP15mo ago
Let me create one
Paul Shriner
Paul ShrinerOP15mo ago
GitHub
GitHub - shrinerp/CF-Proxy
Contribute to shrinerp/CF-Proxy development by creating an account on GitHub.
Paul Shriner
Paul ShrinerOP15mo ago
I left all of my extra imports in there, but removed the "path" that I tried in my durable object binding.
Paul Shriner
Paul ShrinerOP15mo ago
I tried that in both index.mts and UserLookup where the object is used. The error points back to the binding. Cannot create binding for class User that is not exported by the script [code: 10061] Which if the class isn't exporting, then CF won't know what to do with it. Made some progress, I changed the binding to v3 That was the issue. Thanks for everyone help looking into this.
Want results from more Discord servers?
Add your server