faas-flow icon indicating copy to clipboard operation
faas-flow copied to clipboard

Cannot use context.Set in faas-flow pipeline.

Open ctakgh opened this issue 2 years ago • 1 comments

Hello,

I'm investigation using faas-flow in my work environment. So far I was able to orchestrate several functions using Apply and Modify methods. My next step is to use context functionality (context.Set("data1-key", "data1-value")) to pass data between different Modify sections of pipeline based on readme info.

I am getting an exception when building faas-flow (faas build -f my-config.yml):

...Step 12/29 : RUN CGO_ENABLED=0 GOOS=linux go build --ldflags "-s -w" -a -installsuffix cgo -o handler . && go test $(go list ./... | grep -v /vendor/) -cover ---> Running in 5aa0fd96ab24 \# handler/function function/handler.go:36:10: context.Set undefined (type *openfaas.Context has no field or method Set)...

Please provide an example (like in https://github.com/faasflow/faas-flow-example) where this functionality is working.

Thank you

ctakgh avatar May 28 '22 15:05 ctakgh

In order for faasflow.Context methods to work, need to use (*sdk.Context)(context) syntax.

ctakgh avatar May 31 '22 18:05 ctakgh