had the same issue. hope they fix this. I think this is just a bug where the queued state cannot be
had the same issue. hope they fix this. I think this is just a bug where the queued state cannot be changed.
Compute time per step) you have 10 seconds (free plan) or 30 seconds (paid plan)

11/21/24, 6:47 PM
.id, I get the following error message: Error: AssertionError: Could not retrieve instance metadata.await instance.status() only gets me an array of the output from the individual steps. Not the final Worfklow return value.Output? Is it only available via the GraphQL API?
await instance.status() only gives me the output of the steps inside the workflow, not the workflow return value.await instance.status().outputstatus() not the output, so (await instance.status()).outputoutput property of the InstanceStatus does not contain the Workflow return value, even when the workflow is completed. I'm only seeing an array of the outputs from the individual steps called inside the workflow.Promise.all is fine.saveNotesStep after the Promise.all and reading the output of the step. In that case if the "save" step fails, the generateNotesStep will have cached the response. It might only be an issue if the serialized data exceeds the limits.const generateTitleStep = step.do(
"Generate the project title",
async () => {
console.log("Generate the project title");
const anthropic = createAnthropic({
apiKey: this.env.ANTHROPIC_API_KEY,
});
return {};
},
);
const generateNotesStep = step.do(
"Generate the project notes",
async () => {
console.log("Generate the project notes");
return {};
},
);
// option A
await step.do("Await all project generation steps", async () => {
await generateTitleStep;
await generateNotesStep;
});
// option B
await Promise.all([generateTitleStep, generateNotesStep]);const generateNotesStep = step.do(
"Generate the project notes",
async () => {
console.log("Generate the project notes");
return "These are some notes returned after awaiting";
},
);
const saveNotesStep = step.do(
"Save the project notes",
async () => {
const notes = await generateNotesStep
// save the data to the DB here. notes have been generated and won't regenerate if this retries
return {};
},
);Compute time per stepexport default {
async fetch(): Promise<Response> {
// Return 400 for direct HTTP requests since workflows should be triggered via bindings
return Response.json(
{ error: "Workflows must be triggered via bindings" },
{ status: 400 },
);
},
async create({ params }: { params: InitSyncParams }, env: Env) {
const workflow = await env.SYNC_REPO_INIT_WORKFLOW.create({ params });
return workflow.id;
},
async terminate(id: string, env: Env) {
const instance = await env.SYNC_REPO_INIT_WORKFLOW.get(id);
await instance.terminate();
},
async getInstanceStatus(id: string, env: Env) {
const instance = await env.SYNC_REPO_INIT_WORKFLOW.get(id);
return await instance.status();
},
};Error: AssertionError: Could not retrieve instance metadata