URL path parameters are not honored
I'm not sure if this is a bug or maybe a feature request, but I have seen some other projects using URL paths in their serverless.yaml.
For example:
functions:
get-users:
handler: handler.getUsers
events:
- http:
method: GET
path: "${self:custom.apiPrefix}/users"
get-user-by-id:
handler: handler.getUserById
events:
- http:
method: GET
path: "${self:custom.apiPrefix}/users/{id}"
request:
parameters:
paths:
id: true
However, it seems this is not used by the Kubeless platform. Both requests route to the get-users function.
Am I missing something, or are URL path parameters not supported? That is kind of a big deal for REST APIs, what are the current workarounds? I can't imagine no one has this problem...
I have considered serverless-http + koa + koa-router but that almost removes the entire point of route definitions here...
The path should be resolved to the path in the ingress object that is created. At the end of the day those are translated to ingress parameters so you can check what's being used if you execute kubectl get ingress -o yaml <ingress_name>.
I think that your problem may be related to the {id} parameter you are trying to use. I think that the proper way of using that would be to use a regexp there:
https://kubernetes.github.io/ingress-nginx/user-guide/ingress-path-matching/