Enterprise customer - cannot perform I/O error
Hi all - I was told to come hear from enterprise support as they were not sure what the issue was.
We're getting a couple of errors on a worker of ours that interacts with a durable object:
1. Cannot perform I/O on behalf of a different request. I/O objects (such as streams, request/response bodies, and others) created in the context of one request handler cannot be accessed from a different request's handler. This is a limitation of Cloudflare Workers which allows us to improve overall performance. (I/O type: OutgoingFactory)
2. this.viewer.fetch is not a function (this.viewer is the durable object)
Can anyone help us diagnose the issue? Unfortunately support weren't able to tell us where or why either of the errors where coming from.
The issue isn't constant, only affecting a small portion of our requests. However, because this worker gets so many requests, we're getting a decent amount of errors.
Thanks
8 Replies
This sounds like you are sharing promises in the global scope. I.e.
Hi @Hard@Work | R2 - thanks for the response. However, we're not declaring any variables at the global scope.
To help narrow it down, would you be able to tell me if that error comes from interacting with the durable object or not?
Or what I/O operation might be throwing the error?
Can you share a code snippet from where this is happening?
@Hard@Work | R2 I'm not sure if this is where the error is coming from but the stack trace seems to suggest this method from our class:
How do you construct instances of this class? Where are they stored?
Hi @Hard@Work | R2 , it is constructed during the Hono router construction under the init() method as such:
And here is the index.ts
@Hard@Work | R2 ?
Sorry, I'm not sure what else it could be...
well at least we're not missing something obvious!
how can we progress from here?