WindmillWWindmill
Powered by
ShenanigansS
Windmill•9mo ago•
4 replies
Shenanigans

Invalid flow failure while handling flow error

Hello, I have recently encountered an error within my flows error handler I can't explain/understand. My error handler is to read the flows state and write it to a database via the following bun script below
import * as wmill from "windmill-client"


export async function main(message: string, name: string, step_id: string, profileName: string) {
  console.log("message", message)
  console.log("name", name)
  console.log("step_id", step_id)

  const err_msg = await wmill.getFlowUserState("err_msg", true)
  const errSource = await wmill.getFlowUserState("errSource", true)
  const poDate = await wmill.getFlowUserState("poDate", true)
  // ...

  console.log(err_msg)
  console.log(errSource)
  console.log(poDate)

  const database = await wmill.getResource('f/client_orgitem_sync/postgre_db_neondb')

  const orgitemStatusArgs = {
    database,
    metadata: orgitemMetadata,
    created_at: new Date().toISOString(),
    error_msg: err_msg,
    errSource: errSource,
    poDate: poDate,
    // ...
    
  }

  const res = await wmill.runScript("f/client_orgitem_sync/submit-myorg-status", null, orgitemStatusArgs)

  return res
import * as wmill from "windmill-client"


export async function main(message: string, name: string, step_id: string, profileName: string) {
  console.log("message", message)
  console.log("name", name)
  console.log("step_id", step_id)

  const err_msg = await wmill.getFlowUserState("err_msg", true)
  const errSource = await wmill.getFlowUserState("errSource", true)
  const poDate = await wmill.getFlowUserState("poDate", true)
  // ...

  console.log(err_msg)
  console.log(errSource)
  console.log(poDate)

  const database = await wmill.getResource('f/client_orgitem_sync/postgre_db_neondb')

  const orgitemStatusArgs = {
    database,
    metadata: orgitemMetadata,
    created_at: new Date().toISOString(),
    error_msg: err_msg,
    errSource: errSource,
    poDate: poDate,
    // ...
    
  }

  const res = await wmill.runScript("f/client_orgitem_sync/submit-myorg-status", null, orgitemStatusArgs)

  return res


But I encounter the error below
6870 | // main.ts
6871 | var wmill = __toESM(require_dist(), 1);
6872 | async function main(message, name, step_id, profileName) {
6873 |   let flow_id = process.env.WM_ROOT_FLOW_JOB_ID;
6874 |   console.log("message", message), console.log("name", name), console.log("step_id", step_id);
6875 |   console.log(err_msg), console.log(errSource), console.log(poDate);
                                                                  ^
TypeError: Right side of assignment cannot be destructured
      at <anonymous> (/tmp/bun/main.js:6875:141)
6870 | // main.ts
6871 | var wmill = __toESM(require_dist(), 1);
6872 | async function main(message, name, step_id, profileName) {
6873 |   let flow_id = process.env.WM_ROOT_FLOW_JOB_ID;
6874 |   console.log("message", message), console.log("name", name), console.log("step_id", step_id);
6875 |   console.log(err_msg), console.log(errSource), console.log(poDate);
                                                                  ^
TypeError: Right side of assignment cannot be destructured
      at <anonymous> (/tmp/bun/main.js:6875:141)


This would eventually lead to the flow crashing(img) and the called script in the error handler not having a log entry for that flow run. The flow ran on 29/05 05:00 UTC. Was there perhaps an update to windmill that occurred then that may have caused this error?
image.png
WindmillJoin
3,362Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Recent Announcements
henri-c

Weekly kenote to tell you about our latest updates https://discord.com/channels/930051556043276338/1278977038430240813 https://youtube.com/live/2dGd9TdT8xs?feature=share

henri-c · 4d ago

Pyra

### HTTP tracing (EE) Capture HTTP requests made by job scripts as observability spans Features: - View HTTP request traces (method, URL, status, timing) in the job details UI - Auto-instrumentation for Native TypeScript, MITM proxy for other languages - Integrates with external OpenTelemetry collectors changelog: https://www.windmill.dev/changelog/http-tracing docs: https://www.windmill.dev/docs/advanced/instance_settings#http-tracing Additionally jobs memory metrics are now fully OSS!

Pyra · 2w ago

henri-c

First keynote of the year here https://discord.com/channels/930051556043276338/1278977038430240813 🙂

henri-c · 4w ago

Similar Threads

Error while fetching flow status
ShenanigansSShenanigans / help
7mo ago
AI Generate Invalid Flow JSON
fooosieeeFfooosieee / help
2mo ago
Error executing flow
antonioalvesAantonioalves / help
3y ago
Start Flow use Claude Error
fooosieeeFfooosieee / help
11mo ago