More docs for nodejs runtime
(I am happy to help with this if I know the right place to put it.)
For someone mainly coming from AWS, I had a lot of questions about running in Kubeless that weren't that hard to track down, but would've been nice to be documented all in one place.
For example (in the docs, this could be explained in more detail):
- the http event is proxied by express
- data passed to the function as
event.datais either a string or an object depending on the request'scontent-typeheader - all HTTP methods are supported by default, and this is not configurable
- functions can return promises for the response they want to return
- functions can return a string, an object (in which case the response's content-type will be application/json) or anything else and that anything else will be JSON.stringify-d
- ~there is no way to return a custom HTTP status code~
- ~there is no way to return custom HTTP headers~
- if you throw an error, the response to the client will always be 500 Internal Server Error
- the only other HTTP response is 408 script timeout (with a default of 180 seconds)(
- CORS is handled by for you automatically and will allow all requested methods and header in the pre-flight, but the allow origin will always be
'*', which will not work with credentialed CORS requests - the shape of the event you get in your function will look like (where request is a standard nodejs request object edit: and
responseis a standard nodejs http response object ):
{
'event-type': req.get('event-type'),
'event-id': req.get('event-id'),
'event-time': req.get('event-time'),
'event-namespace': req.get('event-namespace'),
data,
'extensions': { request: req, response: res },
}
I'm also interested in opening some PRs to extend some of the capabilities to allow for more flexible responses, is that encouraged?
Hi @ianserlin,
It would be great if you want to contribute to the documentation. The right place to do it is this markdown file. We also have more generic documentation about functions here. These md files are used to generate the final documentation from kubeless.io.
Also, we released yesterday v1.0.0-alpha.3 that among other things include the response object in the event.extensions object. You can now modify the headers and status code of it.
If you are interested in opening new PRs the https://github.com/kubeless/kubeless repository is the right place to do it. Thank you in advance!
Great! Awesome about adding response to the extensions, that was definitely going to be my first PR. I'm currently working through webpack issues and when I have a fix I'll start opening some PRs.
It would be better in my opinion if a company which sells services and products put money into writing useful documentation instead of hiding behind the "community" banner and asking unpaid volunteers to write documentation that they themselves should have written.
It's astonishing how terrible the docs are. Nobody in your company can free up a day to write better ones? You have no interns free sitting around with something they need to do?
I get that you want to build a community around your product. But that doesn't mean you get to ask us to do your dirty work because all you guys wanna do is write cool stuff.
I get that documentation is boring and tedious and needs a lot of work. But for gods sake. Hire an intern. Do something. But this lack of even basic documentation is more than a year old and what have you got to show for it?
It's such a pity, because it looks a good product. It's just a pity you can't be bothered doing a better job.
Hi @christhomas,
You can find some documentation about NodeJS in that link:
https://kubeless.io/docs/runtimes/#nodejs
And you can find several examples in this repository:
https://github.com/kubeless/runtimes/tree/master/stable/nodejs
Note that this is an open source and free product, please be respectful with the people working on it.
Serverless is an incorporated company with a pretty large team of engineers and even a CEO. Please don't hide and abuse the open source term so you can hide from your obligations to do a proper, professional job.
You guys aren't a bunch of hobby teenagers living in your mom's house, working after school. You're a team of professionals and I take objection to you trying to deflect criticism of the shoddy work and documentation by pretending this is a community project.
You guys earn real money, enough to hire all those people. You can hire an intern to write better documentation.