-
-
Notifications
You must be signed in to change notification settings - Fork 21
Description
itty-durable currently scans all bindings (the contents of env) to find Durable Object namespace bindings. It decides that a binding is a DO namespace if it has a method idFromName.
itty-durable/src/itty-durable.js
Lines 32 to 36 in 86c8f01
| for (const [key, binding] of Object.entries(env)) { | |
| this.state[key] = typeof binding.idFromName === 'function' | |
| ? proxyDurable(binding, { name: key, parse: true }) | |
| : binding | |
| } |
In the near future, Workers will introduce a binding type that is a proxy object which appears to have methods of every possible name. Hence, this binding type will incorrectly be detected as a Durable Object namespace.
It appears the effects of this are mostly benign, but it might be worth tightening the test. I think you could perhaps detect these proxy objects by also checking for the presence of an unlikely method name, like __methodThatWillNeverBeDefined or something. If that exists and is a function, you are probably looking at a proxy and not a DO namespace.