KV Namespace methods break when passed through constructor
Hey everyone,
I'm trying to make my KV namespaces accessible in my services using dep injection with tsyringe. Is this something that is known to be unsupported?
I found that after injecting the kv namespace the put() and get() methods seemingly blocks execution of anything coming after it, without any errors and no data being set or retrieved.
I would prefer for my services to have the kv namespaces available instead of having to pass it from the request handler (hono with trpc) through to my repository class.
I have a middleware for Hono set up like this.
3 Replies
I didn’t use cloudflare cache…I can share you repo where I implemented this.
I don't think I am using cloudflare cache either? I noticed that as soon as I pass a kv namespace through a constructor the methods on that namespace just seem to not work, regardless of tsyringe or not. But yeah please share 🙂
I have sent you code in dm