https://discord.cloudflare.com logo
Join Discord
Powered by
# durable-objects
  • g

    Greylock

    06/29/2021, 3:42 PM
    the API response from wrangler seems to include the handlers
  • g

    Greylock

    06/29/2021, 3:43 PM
    Copy code
    toml
    bindings = [
        { name = "rooms", class_name= "ChatRoom" },
        { name = "limiters", class_name = "RateLimiter" }
    ]
  • g

    Greylock

    06/29/2021, 3:44 PM
    oh well, theres no mention of the term ``rooms`` anywhere in the requests wrangler uses to upload the worker.
  • g

    Greylock

    06/29/2021, 3:45 PM
    Copy code
    toml
    type = 'javascript'
    name = "coincrash-dev"
    account_id = '009cb107e5dbe5802252ce09d6a0e301'
    route = 'dev.coincrash.com/*'
    zone_id = 'bb7c0c340ce129139faac2ee87806ce9'
    
    [site]
    bucket = "./build"
    
    [env.staging]
    name = 'coincrash-staging'
    zone_id='bb7c0c340ce129139faac2ee87806ce9'
    route = 'staging.coincrash.com/*'
    
    [env.production]
    name = 'coincrash'
    zone_id='bb7c0c340ce129139faac2ee87806ce9'
    route = 'coincrash.com/*'
    
    [env.test]
    name='coincrash_test'
    zone_id='bb7c0c340ce129139faac2ee87806ce9'
    route = 'test.coincrash.com/*'
    
    
    [build]
    command = 'npm install && npm run build'
    [build.upload]
    format = 'modules'
    dir = 'workers-site'
    main = './index.mjs'
    
    [durable_objects]
    bindings = [
        { name = "rooms", class_name= "ChatRoom" },
        { name = "limiters", class_name = "RateLimiter" }
    ]
  • g

    Greylock

    06/29/2021, 3:45 PM
    theres my full toml file
  • g

    Greylock

    06/29/2021, 4:03 PM
    im not sure but the bindings dont appear to be working
  • w

    Wallacy

    06/29/2021, 4:03 PM
    its supposed to work, usually i use the "env.EXAMPLE_CLASS.idFromName" notation. One small question, did you pass --new-class ChatRoom --new-class RateLimiter to you publish?
  • w

    Wallacy

    06/29/2021, 4:03 PM
    because that is not automated yet...
  • g

    Greylock

    06/29/2021, 4:03 PM
    no
  • g

    Greylock

    06/29/2021, 4:03 PM
    I have to do that?
  • w

    Wallacy

    06/29/2021, 4:03 PM
    yes
  • g

    Greylock

    06/29/2021, 4:03 PM
    every time, for every class?
  • w

    Wallacy

    06/29/2021, 4:03 PM
    first time for every class
  • g

    Greylock

    06/29/2021, 4:03 PM
    oh
  • g

    Greylock

    06/29/2021, 4:03 PM
    maybe I can look at the wrangler source code
  • g

    Greylock

    06/29/2021, 4:03 PM
    and automate it with a pull request
  • w

    Wallacy

    06/29/2021, 4:03 PM
    will raise a error if the class already exists
  • g

    Greylock

    06/29/2021, 4:04 PM
    I already got wrangler to work with KV and modular code
  • g

    Greylock

    06/29/2021, 4:04 PM
    so it already can tell if it exists, but doesnt add it. Interesting.
  • g

    Greylock

    06/29/2021, 4:04 PM
    ill try and see if I can add it then
  • g

    Greylock

    06/29/2021, 4:04 PM
    oh yeah
  • g

    Greylock

    06/29/2021, 4:04 PM
    that added ``new_classes`` to the metadata
  • g

    Greylock

    06/29/2021, 4:06 PM
    anyways, thanks so much
  • w

    Wallacy

    06/29/2021, 4:06 PM
    😉
  • c

    carlson

    06/29/2021, 4:06 PM
    @User what environment are you testing it?
  • g

    Greylock

    06/29/2021, 4:06 PM
    idk where you found that cuz the docs didnt say that as far as I can tell
  • g

    Greylock

    06/29/2021, 4:06 PM
    wdym
  • g

    Greylock

    06/29/2021, 4:06 PM
    oh
  • g

    Greylock

    06/29/2021, 4:06 PM
    ``test``
  • g

    Greylock

    06/29/2021, 4:07 PM
    its still undefined though
1...115116117...567Latest