ai
04/12/2021, 6:21 PMtheGagne
04/12/2021, 6:23 PMhabitat
04/12/2021, 8:55 PMObject Location
Not all Cloudflare locations support Durable Objects yet, so objects may not be created in exactly the same point-of-presence where they are first requested.
Currently, Durable Objects do not migrate between locations after initial creation. We will be enabling automatic migration in the future.
habitat
04/12/2021, 8:55 PMhabitat
04/12/2021, 8:57 PMDeleted User
04/12/2021, 9:01 PMtheGagne
04/12/2021, 10:19 PMKevin W - Itty
04/12/2021, 10:35 PMTaral
04/13/2021, 12:15 AMClass.prototype
didn't work?Kevin W - Itty
04/13/2021, 12:17 AMTaral
04/13/2021, 12:18 AMTaral
04/13/2021, 12:18 AMKevin W - Itty
04/13/2021, 12:22 AMnightvisi0n
04/13/2021, 6:54 AMcf
(geolocation, etc..) property in the incoming request
object.
I haven't found anything about a limitation regarding that in the docs, am I overseeing sth?john.spurlock
04/13/2021, 3:27 PMnightvisi0n
04/13/2021, 3:29 PMmatt
04/13/2021, 5:09 PMrequest.cf
comes from FL (the nginx reverse proxy that handles all incoming requests to the cloudflare edge).
Since durable objects requests come directly from other workers, FL isn't involved, so we don't have a value to pass for it.
Passing through the request.cf
value from the eyeball isn't a perfect solution either, as some of the cf
attributes would be more useful if they referred to the durable object, rather than the eyeball worker (such as the colo name).matt
04/13/2021, 5:10 PMrequest.cf
values for the eyeball request, you can always include it in the body of a fetch()
to your durable object.alex.b
04/13/2021, 9:22 PMKevin W - Itty
04/13/2021, 10:38 PMjs
class Counter extends IttyDurable {
increment() {
this.counter = (this.counter || 0) + 1
}
}
with your Worker this simple:
js
import { ThrowableRouter, missing } from 'itty-router-extras'
import { withDurables } from 'itty-durable'
export { Counter } from './Counter'
const router = Router()
router
// access method on stub, indirectly firing method on DO instance, and returning a JSON Response of the DO contents
.get('/:whichcounter/increment', withParams, withDurables(),
({ whichcounter, Counter }) => Counter.get(whichcounter).increment()
)
.all('*', () => missing('Are you sure about that?'))
export default { fetch: router.handle }
// GET /test/increment --> { counter: 0 }
// GET /test/increment --> { counter: 1 }
Unsmart | Tech debt
04/13/2021, 11:20 PMstorage.put
storage.list
directly?
I havent tested it yet but it seems like from your usage in the Counter.js example that it only saves variables you add to the class and they all go into the "data" key on storage.put if I am reading the IttyDurable code correctly.Kevin W - Itty
04/13/2021, 11:44 PMthis.state.storage
, so you can access that wherever you likeKevin W - Itty
04/13/2021, 11:45 PMgetPersistable()
(you can override in child class) gets dumped as a single unit into the data
key. It's a simplistic approach that can be overridden via the persist()
and initialize()
methodsKevin W - Itty
04/13/2021, 11:46 PMKevin W - Itty
04/14/2021, 12:07 AMUnsmart | Tech debt
04/14/2021, 12:43 AMKevin W - Itty
04/14/2021, 12:55 AMvans163
04/14/2021, 2:32 AMSec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
permessage-deflate and maxwindowbits supported?vans163
04/14/2021, 2:32 AM