Should `unsafe.bindings.ratelimit` have different `namespace_id` for each worker environment?

Lets say I have
[[unsafe.bindings]]
name = "RATE_LIMITER"
type = "ratelimit"
namespace_id = "1001"
[[unsafe.bindings]]
name = "RATE_LIMITER"
type = "ratelimit"
namespace_id = "1001"
Do I need to have different namespace_id for each environment? If so how do we do it? I tried
[env.dev.unsafe.bindings]
name = "RATE_LIMITER"
type = "ratelimit"
namespace_id = "1002" # Dev namespace ID
simple = { limit = 10, period = 60 }

[env.staging.unsafe.bindings]
name = "RATE_LIMITER"
type = "ratelimit"
namespace_id = "1003" # Staging namespace ID
simple = { limit = 10, period = 60 }

[env.production.unsafe.bindings]
name = "RATE_LIMITER"
type = "ratelimit"
namespace_id = "1004" # Production namespace ID
simple = { limit = 10, period = 60 }
[env.dev.unsafe.bindings]
name = "RATE_LIMITER"
type = "ratelimit"
namespace_id = "1002" # Dev namespace ID
simple = { limit = 10, period = 60 }

[env.staging.unsafe.bindings]
name = "RATE_LIMITER"
type = "ratelimit"
namespace_id = "1003" # Staging namespace ID
simple = { limit = 10, period = 60 }

[env.production.unsafe.bindings]
name = "RATE_LIMITER"
type = "ratelimit"
namespace_id = "1004" # Production namespace ID
simple = { limit = 10, period = 60 }
But I get the error
{"name":"RATE_LIMITER","type":"ratelimit","namespace_id":"1002","simple":{"limit":10,"period":60}} is not of type "array"
1 Reply
cj
cjOP7mo ago
I fixed it
[env.dev.unsafe]
bindings = [
{name = "RATE_LIMITER", type = "ratelimit", namespace_id = "1002", simple = { limit = 30, period = 60 }}
]
[env.dev.unsafe]
bindings = [
{name = "RATE_LIMITER", type = "ratelimit", namespace_id = "1002", simple = { limit = 30, period = 60 }}
]
Ty. This is much better
Want results from more Discord servers?
Add your server