kwhitley / itty-durable

Cloudflare Durable Objects + Itty Router = shorter code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possible error when not using proxydurable function to access class

janat08 opened this issue · comments

I tested this a couple of weeks ago, so I don't remember if it's an issue. Simply accessing durable from request somehow fails, so you have to use the proxydurable export on environment variable for durable object binding.

I think this might have something to do with itty-router because I noticed my own class (not DO) doesn't persist as an object; instead, I end up having to Object.assign(passedData, new MyClass())

I haven't wrapped my mind around all of the router's 30 some lines of code to figure out why that may be. (as in, I'm impressed with its brevity)

edit: sorry, didn't really the original close enough and sounded like something I found from the router.

I think you’re writing about something else this is for when using do middlewear to bind classes to request, which returns undefined. I don’t think that assigning class to data is useful in a way that you think it is.

Definitely wouldn't/shouldn't be itty as the culprit (likely a break in my DO logic or perhaps a revision to how DO works in general, as this was developed shortly after they came out of beta last year)... but I need to dust this arm of development off anyway!

Thanks for the reminder - couple days of intense interviews this week, then I'll take a look and see if we can get this all sorted :)