Closed alexellis closed 6 years ago
The header may already be serialized - https://github.com/openfaas/faas/blob/master/gateway/queue/types.go#L10
There may be many concurrent requests to the same function, so will each function call be guaranteed to have the environment variables set to its proper value at the time of function execution?
For example, I send data blob A
to the function with environment variable setting a parameter to b
. At nearly the exact same time, another user sends data blob C
to the same function with parameter set to d
. Will it be guaranteed that when the function operates on A
, the environment variable will still be b
, and not d
?
Let me know if this makes sense. Thanks
We fork a process for each request in the watchdog and in afterburn we are passing data in the same way to a single process. This work is complete for synchronous calling. The ticket is for implementing in the queue code.
I can take a look
Fix: https://github.com/openfaas/nats-queue-worker/pull/7
@alexellis needless to say, when the PR is approved, you have to push a new docker image at functions/queue-worker:#tag
and then change the following lines in docker-compose.extended.yml
queue-worker:
image: functions/queue-worker:#tag
And then the issue can be finally closed!
Thanks for working on this.
Merged, thanks @wonderxboy
Custom headers and QueryString should be serialized and passed onto function.
Expected Behaviour
Custom headers such as
X-Forwarded-By
or query string values such as?id=alex
should be passed onto the function when it is invoked by a queue worker.Current Behaviour
Ignored by async, passed by synchronous invocations.
Possible Solution
Alter the en-queuing code to serialize this additional data
Steps to Reproduce (for bugs)
Should result in two headers being exposed as environment:
Context
Additional meta-data is key when the body of a request is RAW binary.
Your Environment
Tested on Swarm but counts for any provider.