is it bad if i make a DO and then just "forget" about it? is there a way to tell cf "likely won't be
is it bad if i make a DO and then just "forget" about it? is there a way to tell cf "likely won't be using this, you can erase it"
deleteAll(), you can reference the same ID and get it running again.[ERROR] TypeError: Cannot read properties of undefined (reading 'MY_BUCKET'). I can do R2 operations in the hono routes but not within the DO at the moment using the bindingsenv you get in the DO constructor has nothing to do with the Hono env. In your code it should be the Bindings directly. So doing await this.env.MY_BUCKET.put(...) will probably work.that they should be architecting their app for autocleanup/storing IDs somewhereI still don't agree with this. Autocleaning are very different things from storing IDs.
wrangler.toml/json that has [env.__REPLACEME__.durable_objects], and you replace that placeholder in your CI with the PR identifier (ie.. PR_ID), and then run wrangler deploy -c path/to/wrangler.toml --env=<PR_ID>.put accepts a ReadableStream, I was also wonder that if it's possible to implement streaming exporting a DO's storage this way.
Env[Bindings] to the DO.type Bindings = {
MY_BUCKET: R2Bucket
MY_DO: DurableObjectNamespace<MyDurableObject>
}
type Variables = {}
export type Env = {
Bindings: Bindings
Variables: Variables
}export class MyDurableObject extends DurableObject<Env> {
storage: DurableObjectStorage
constructor(ctx: DurableObjectState, env: Env) {
super(ctx, env)
this.storage = ctx.storage
console.log('DO constructor', this.env)
}
async test() {
const upload = await this.env.Bindings.MY_BUCKET.put(`test`, 'test')
return upload
}
}// do imported above
const id = c.env.MY_DO.idFromName('my-durable-object')
const durableObject = c.env.MY_DO.get(id)
const zipFile = await durableObject.test()
return c.json({ message: 'Test', zipFile })
export {MY_DO}DO constructor {
MY_DO: DurableObjectNamespace {},
MY_BUCKET: R2Bucket {},
}
✘ [ERROR] TypeError: Cannot read properties of undefined (reading 'MY_BUCKET')