I took a deep dive into Serverless yesterday and basically spent my day on the examples. It took me a while to understand that the GCP support was fairly new and incomplete. It wasn’t obvious to me that the configuration file
serverless.yml would be so different depending on the providers. I therefore spent quite a lot of time trying to mix examples I found with AWS which aren’t compatible at all with GCP, like for instance the
handler: handler which is rather
handler: index.handler using AWS.
There are no plugins for Google on the repository either: https://github.com/serverless/plugins or if there are, it’s hard to figure out which ones.
So, after many hours wasted, here are the following things I advise to improve:
- Tag the Serverless plugins to make it easier to know for what platform they are compatible with.
- Make it obvious that GCP are fairly new and not still in Beta, and lack documentation/example. For instance, there is no equivalent of the
serverless.ymlformat for GCP like there is for AWS and that would be very useful.
- People will eventually run into plugins or code example about AWS, so giving some head on about the major differences in the
serverless.ymlis a must have. I’m thinking about the
mainfor GCP when not using a
index.jsfile, this isn’t an issue with AWS to change the filename, but it requires a special configuration change in GCP which leads to misunderstanding and frustration. Also, the format to be used to declare function handlers should be clearly explained.
- An equivalent of Serverless Offline (https://github.com/dherault/serverless-offline) for GCP should be released ASAP (or update the repo to add GCP support), because when you’re starting playing around and are waiting 40s-1mn between every change in your app, it’s a mood-killer. I personally looked directly into how to run it locally, found serverless-offline and after much doc reading, understood that I couldn’t use it. Then looked for a GCP version and found none and got very disappointed because Serverless is not actually usable without being able to play around. There is a lot of new stuff and waiting a minute to see our changes feels just wrong. I do understand that not everything can be mocked though, but there are a lot of mistakes at the beginning and having such a long deployment time make the learning curve increase way too much IMHO.
- Google Functions only handle node 6.11, and that’s also where Serverless can be quite useful by providing a easy-to-use plugin like ES6-8 transpilation or typescript like there are for AWS.
Currently, I’ve reached a point where I believe Serverless is an awesome solution, but still to young to be used with GCP (and, let’s be honest, GCP is also really young and lack a lot of features, which doesn’t help Serverless to shine either). So I’m currently waiting for my AWS account to be enabled and I’ll likely host my code on AWS instead of GCP but only because Serverless isn’t ready for it yet. (and hope it becomes mature enough before the end of Amazon free trial)
Also, Serverless takes pride by being Provider agnostic, but that’s just a marketing lie. It’s true in the sense that it’s not strongly coupled to any provider and can be used with any, but it’s a lie because you can’t just switch to one provider to another without going through huge and deep changes in both your configuration and source code, depending on what you do.
I hope this helps focusing on the right things to improve GCP support.