Skip to content

Commit b9dd499

Browse files
committed
fix: stop panicking when invoking workflows
The invoke repsonse doesn't have a run, so we should check for the run before trying to get the run's Name. Signed-off-by: Donnie Adams <[email protected]>
1 parent 82f65b4 commit b9dd499

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/api/handlers/invoke.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,14 @@ func (i *InvokeHandler) Invoke(req api.Context) error {
111111
return req.WriteEvents(resp.Events)
112112
}
113113

114+
var runID string
115+
if resp.Run != nil {
116+
runID = resp.Run.Name
117+
}
118+
114119
req.ResponseWriter.Header().Set("Content-Type", "application/json")
115120
return req.Write(map[string]string{
116121
"threadID": resp.Thread.Name,
117-
"runID": resp.Run.Name,
122+
"runID": runID,
118123
})
119124
}

0 commit comments

Comments
 (0)