serverless / serverless-plugin-typescript

Serverless plugin for zero-config Typescript support
MIT License
783 stars 222 forks source link

[Feature Request] OpenWhisk support would be awesome #93

Open develpr opened 6 years ago

develpr commented 6 years ago

I've seen that there is now support for google as a provider with one of the somewhat recent changes, but it would be awesome to also include support for OpenWhisk. I'm going to look to see if I can figure out what would be involved in this, but if anybody has any great thoughts / feelings about this I would be very appreciative!

develpr commented 6 years ago

I spent a bit of time looking at this and it seems like things almost "just work", but there is an issue (not sure if it's an "issue" or just an incompatibility!) with how OpenWhisk validates actions that causes issues when used with the typescript plugin. You can see the tiny changes (just temporary for now!) I made in a fork of the openwhisk repo to see what I'm talking about:

https://github.com/develpr/serverless-openwhisk/commit/a0c96176ae73479011bccd31e395f19cceededf4

develpr commented 6 years ago

I ended up adding a PR after spending some time looking at how this plugin works with the serverless-openwhisk plugin. The PR (linked here) is pretty small and simple and basically just filters out "sequence" functions which in OpenWhisk may not actually contain a handler.

There is also a problem on the OpenWhisk side of things that I also have a PR out there for, which is that the openwhisk plugin will check for a particular handler with a hardcoded ".js" extension in the originally defined path. So, if you have myFunction.ts for example, that is being transpiled by the typescript plugin then the openwhisk plugin will throw an exception because it expects myFunction.js to exist. Anyway, I have a somewhat band-aid (?) fix of a PR out there in the OpenWhisk plugin to solve this for now.

Given a bit more time I'll try to test the full scope of what OpenWhisk + Serverless can do with the tyepscript implementation and hopefully write some tests also, for now I'm not sure that my small fixes will solve every incompatibility but at least it's something!