Skip to content
Swarvanu Sengupta edited this page Jul 16, 2019 · 4 revisions

1. Error: workflow_name must be provided

faas-flow function forwards the asynchronous request to itself through the gateway. In order to do that the it need to know the name of itself. This is done by setting the workflow_name in the environment.

environment:
    gateway: "gateway:8080"
    workflow_name: "<function-name>"

2. What is a minimal definition for a faas-flow fucntion?

Below is a minimal definition for faas-flow function in the stack.yml file:

  my-faas-flow:
    lang: faas-flow
    handler: ./my-faas-flow
    image: s8sg/my-faas-flow:latest
    labels:
      faas-flow: 1
    environment:
      write_debug: true
      combine_output: false
      workflow_name: "my-faas-flow"
      gateway: "gateway:8080"
      enable_tracing: false 
      enable_hmac: false

In the my-faas-flow/handler.go file:

package function

import (
    "fmt"
    faasflow "github.com/s8sg/faas-flow"
)
func Define(flow *faasflow.Workflow, context *faasflow.Context) (err error) {
     flow.SyncNode().Modify(func(data []byte) ([]byte, error) {
			data = []byte("you said " + string(data))
			return data, nil
		})
     return nil
}

func DefineStateStore() (faasflow.StateStore, error) { return nil, nil }
func DefineDataStore() (faasflow.DataStore, error) { return nil, nil }

Clone this wiki locally