Faas: Proposal: Support HTTP Paths and verbs for async-function route

Created on 17 Jan 2019  路  9Comments  路  Source: openfaas/faas


Reusing the function described in Lab 4,
curl -X POST http://127.0.0.1:8080/async-function/env/some/path gives a value of / in Http_Path and not /some/path like you'd expect (and is the case with /function). Probably related to https://github.com/openfaas/faas/issues/369

Expected Behaviour


Http_Path=/some/path

Current Behaviour


Http_Path=/

Possible Solution


Steps to Reproduce (for bugs)



See above

Context


Your Environment

  • FaaS-CLI version ( Full output from: faas-cli version ):
    CLI:
    commit: a141dedf94ffeed84412365fd591bdc8999c5a1b
    version: 0.8.3

Gateway
uri: http://127.0.0.1:8080
version: 0.9.14
sha: a65df4795bc66147c41161c48bfd4c72f60c7434
commit: Update swagger for missing secret definitions

Provider
name: faas-swarm
orchestration: swarm
version: 0.6.1
sha: 3cac0ccc2e8bb7f567739a33f7d414cdb58440aa

  • Docker version docker version (e.g. Docker 17.0.05 ):
    Client: Docker Engine - Community
    Version: 18.09.0
    API version: 1.39
    Go version: go1.10.4
    Git commit: 4d60db4
    Built: Wed Nov 7 00:47:43 2018
    OS/Arch: darwin/amd64
    Experimental: false

Server: Docker Engine - Community
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:55:00 2018
OS/Arch: linux/amd64
Experimental: true

  • Are you using Docker Swarm or Kubernetes (FaaS-netes)?
    Swarm

  • Operating System and version (e.g. Linux, Windows, MacOS):
    MacOS 10.14.2

  • Link to your project or a code example to reproduce issue:

  • Please also follow the troubleshooting guide and paste in any other diagnostic information you have:

desigreview prioritlow

Most helpful comment

I will do that.

All 9 comments

Hi,

This is working as designed. The asynchronous route handler also only accepts HTTP POST. It is for creating asynchronous invocations of functions, not for serving HTTP. You should however be able to pass query string to this endpoint.

Alex

Derek add label: priority/low

I see. It get that there's a difference between GET and POST calls, but wasn't expecting such a difference between /function and /async-function. As it is, I've created a number of functions that rely on the Http_Path (abuse it?) to pass on some obligatory singleton parameters (with optional and array parameters in the query string) and now it appears they don't work asynchronously. So if you don't want to add it, I'd remove Http_Path passing also from synchronous POST calls for consistency. In any case I'd mention this behaviour in Lab 4, which is where I learnt about it.

Ha, I thought I could quietly experiment a bit in a fork, but GitHub gave me away so we might as well discuss this.

In the end it was simple enough to implement this behaviour, even though it was literally the first time I looked at source code written in Go. Turns out that the required work in the gateway was already done in August (decf9addb37bec43e1ae7b91fb860837671597b6), I just had to update the vendored version of faas/gateway/types.go.

@jpauwels do you want to raise a PR?

I think this could be useful to people using TensorFlow Serving, where the URL needs to be specified to work.

Please can someone raise a PR to bump the queue version for YAML, helm and docker-compose?

https://github.com/openfaas/nats-queue-worker/releases/tag/0.7.1

Leave off arm and arm64.

Alex

I will do that.

Thank you Vivek 馃憤

Derek close

Was this page helpful?
0 / 5 - 0 ratings