I am putting together a plugin for an additional provider for the serverless framework. At the moment this is a proof of concept integration with a Docker back-end to allow serverless functions to be deployed to on-prem / private / hybrid-cloud.
I’ve taken a look at the existing provider extensions and then gone on to map out some of the structure to add the “provider” plugin etc.
I know there will be a lot of work to get to something fully functional - but I can’t even get to hello world yet because the serverless CLI is giving me an error about a list of available providers. I tracked down the source code and unit test that produces this error message but it appears to be hard-coded to a single provider (so I don’t think this is the source of the error with the released code)
Any help appreciated I’ve seen the “plugin” guide - but this is a different type of plugin - we’re talking about a provider/backend here.
The source for the plugin so far is available in my Github repo (linked), this is the provider error:
serverless
Serverless Error ---------------------------------------
Provider "faas" is not supported. Valid values for provider
are: aws, azure, google, openwhisk. Please provide one
of those values to the "provider" property in serverless.yml.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Forums: forum.serverless.com
Chat: gitter.im/serverless/serverless
Your Environment Information -----------------------------
OS: linux
Node Version: 6.10.2
Serverless Version: 1.12.1
just looked into your source. Looks good so far. You only need to hook into lifecycle events or define commands so that you can call the request method from the CLI.
You’re right. We’re currently whitelisting the supported providers. Best would be if you fork the serverless repo and modify the array with the whitelisted providers (can be found in the Service.js class).
After adding faas there you should be able to run your plugin as an own, independent provider plugin.
Just dropping the different provider implementations here (for inspration):
What do you think about submitting a PR to Service.js along the lines of the following (to enable development):
if (providers.indexOf(serverlessFile.provider.name) === -1
&& serverlessFile.provider.name != process.env.SERVERLESS_PROVIDER ) {
Failing that, once I’ve extended the hard-coded array in my own fork, what is the best way to override the released serverless global CLI/package with my forked version?
I’ll have more questions once past this stage, I think this was the primary blocker for me.
if (providers.indexOf(serverlessFile.provider.name) === -1
&& serverlessFile.provider.name != process.env.SERVERLESS_PROVIDER ) {
Yes, that looks like a potential solution!
Maybe we could remove this whitelisting of providers altogether and just check if a value is provided as a string (and therefore not null). Not 100% sure what the intention was when decided to add it.
This way Serverless will be way more open for other plugin authors to integrate their provider solution.
Sorry to revive an older post, but I’m also looking into building a provider of my own, and I was wondering what the current state is regarding the white-listing. I don’t feel like having my user-base installing a fork of serverless, and feel even less like maintaining it… Thanks!