hello here. I have a weird behavior,
hello here. I have a weird behavior, sometimes, my worker that talks to a durable object, does not reach the durable object but the worker itself.
I could clearly debug that sometimes, the response that I get is not returned by the Durable Object but by the worker itself.
Any clue?
8 Replies
I can now debug it and prove it
it seems to happen when I enable the Log via the UI. I know it seems crazy but I can show and prove it someone is available for that
I'm guessing you mean you don't get a response from the DO, but rather it's generated by the Worker instead?
You can wrap your request in a
try...catch
and read the .remote
property off the exception to see if the error is coming from the DO application code or from the Workers Runtime itself.Cloudflare Docs
Error handling · Cloudflare Durable Objects docs
Review how to handle errors (exceptions) generated by both your own Durable Object code as well as exceptions thrown by Durable Objects’ …
hey @milan thanks! I will have a look, but I don't have exception though
here it's pretty obvious for me when I attach logs, I can see my api not working, because suddenly the durable object is not reached
my worker tries to reach the
/something
of the durable object. When I attach a log (but at first I thought it was random) then my worker does not reach the durable object but the /something
of my worker. There is no exception in the DO, not in the worker
nop I don't think that's normal, I do think I don't have errors when I don't start the logs though. but that's odd why would my worker hit itself when I attach wanna see the log???What do you mean by "attach a log"? Do you mean you're doing
console.log("some message");
?
I'm also not sure what you mean by "why is the working hitting itself". If you're creating a Durable Object stub, and then calling a method on it, then it you're certainly sending a request to the DO, not the worker.
It's possible the request doesn't reach the DO, in which case you'll get an exception instead of a Response
from fetch()
hello @milan I can assure you that I don't hit the DO, the worker gets a HTTP response from itself (home page of the worker in this case) instead of getting a response from the DO.. like a routing issue of some sort.
It seems to happen when I "begin a log stream" from the UI.
then it you're certainly sending a request to the DO, not the worker.that's my issue it does not happen this way, and that's really really weird Could do a video to show ok thanks to @Hard@Work I have a video and more debug/log/trace to show you that enable the Log Stream changes the routing.... so sure I should share the video here
Definitely share it, I'm not familiar with log stream but if requests aren't reaching a Durable Object when it's enabled that sounds very broken.
What are the steps to reproduce here? Could you share a script and a step by step reproduction? Will help us address any issues much quicker!
Just shared the video to you, and can do a Meet or something to show you, I have a staging and can trigger this on purpose now. there is a bug somewhere
btw here, the bug (there was a bug in CF) is fixed !