@@ -4,9 +4,10 @@ import (
44 "context"
55 "encoding/json"
66 "fmt"
7- "github.com/serverledge-faas/serverledge/internal/node"
87 "time"
98
9+ "github.com/serverledge-faas/serverledge/internal/node"
10+
1011 "github.com/lithammer/shortuuid"
1112 "github.com/serverledge-faas/serverledge/internal/function"
1213 "github.com/serverledge-faas/serverledge/internal/scheduling"
@@ -37,6 +38,24 @@ func (s *FunctionTask) SetNext(nextTask Task) error {
3738
3839func (s * FunctionTask ) execute (input * TaskData , r * Request ) (map [string ]interface {}, error ) {
3940
41+ // FIXME: We are adding additional inputs from r.Params to match the function signature. This workaround should be
42+ // dropped when we introduce the possibility to specify additional parameters for functions in a workflow.
43+
44+ funct , exists := function .GetFunction (s .Func )
45+ if ! exists {
46+ return nil , fmt .Errorf ("funtion %s doesn't exists" , s .Func )
47+ }
48+ if funct .Signature == nil {
49+ return nil , fmt .Errorf ("signature of function %s is nil. Recreate the function with a valid signature.\n " , funct .Name )
50+ }
51+ for _ , inputDef := range funct .Signature .GetInputs () {
52+ v , found := r .Params [inputDef .Name ]
53+ _ , alreadyDefined := input .Data [inputDef .Name ]
54+ if found && ! alreadyDefined {
55+ input .Data [inputDef .Name ] = v
56+ }
57+ }
58+
4059 err := s .CheckInput (input .Data )
4160 if err != nil {
4261 return nil , err
0 commit comments