When we set out to build the Serverless Framework, we wanted to streamline how developers build things and how they interact with cloud providers.
We strive to get developers to the "aha" 💡 moment of the serverless experience as soon a possible. This moment where their eyes light up & they see the world of possibilities that functions-as-a-service world opens to them.
We work day and night (thanks team Europe), towards streamlining the developer experience but still one of biggest hurdles we have is getting new developers setup with a functions provider.
It's not impossible but it sure ain't easy. Until now.
Welcome Auth0 Webtasks as a the newest deployment targets and functions provider to the Serverless Framework 🎉.
Born out of Auth0 rules, Webtasks allows users to write & deploy nodeJS code without having to think about the underlying server.
Using the serverless webtasks integration allows framework users to write their serverless services using the standard serverless.yml
configuration and deploy functions into Auth0 Webtasks.
Setup takes about a minute and 30 seconds. Watch the video above.
Node 8 runtime support. This allows users to use the latest and greatest JS today without needing to transpile their code. 🎉
There is also small persisted state that you can re-use within functions. This is currently limited to a 500k json doc.
That's right, no cold starts (drops mic). If you have something that needs to be super snappy, say a backend API, I'd suggest running that through a Webtasks function to avoid cold start latency.
One thing to note: There is a soft limit of 1 request per second on the Auth0 Webtasks free tier.
Inside your Webtask functions you have full access to the npm ecosystem to pull in your favorite modules to get the job done.
Here are some common use cases for Webtask functions:
It's incredibly easy to get started with Webtasks. You can be up and running in 1 minute (or 2:30 minutes) as seen here:
We will be setting up Webtasks with the sls create
service command. You can also install the serverless-webtasks plugin in an existing service to deploy your functions to Webtasks.
Make sure you have nodeJS installed on your machine and also the Serverless Framework
# install serverless globally
npm install serverless -g
# generate a webtasks starter template
serverless create --template webtasks-nodejs --path my-new-webtask-service
Inside the my-new-webtask-service
directory run:
npm install
serverless config credentials --provider webtasks
Then enter your email or phone number and verify the code.
Thats it. You are setup and ready to deploy live code.
Inside the my-new-webtask-service
directory run:
serverless deploy
This will package your code and deploy it into the Webtasks cloud.
The CLI will return your live function endpoint for you to use in your app.
Serverless: Packaging service...
Serverless: Packaging disabled for function: "main"
Serverless: Deploying function: main...
Serverless: Successfully deployed function: main
Service Information
service: webtasks-nodejs
stage: dev
endpoints:
* - https://wt-31e332423432391d99fb-0.sandbox.auth0-extend.com/Webtasks-nodejs-dev-main
functions:
main: webtasks-nodejs-dev-main