Fireship · @fireship
Scheduled Cloud Functions - NOT for Robocallers
Uploaded April 23, 2019 · Length 7:30
Summary
Create a scheduled task queue with Firebase Cloud Functions, using pub/sub and Firestore to run backend code at any time.
- firebase cloud functions
- scheduled tasks
- pub/sub
- firestore
- task queue
- backend code
- cron schedule
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
yesterday you may have seen a video
- 0:01
about building an industrial scale Robo
- 0:03
collar I decided to take that video down
- 0:05
and destroy all the physical copies
- 0:06
because even though it's an obvious joke
- 0:07
it's not the right way to be using those
- 0:09
tools but the good news is that I recut
- 0:11
that video and it keeps the most
- 0:12
important part intact which is building
- 0:14
a scheduled task queue with firebase
- 0:15
cloud functions and make sure to leave a
- 0:17
comment on this video for the t-shirt
- 0:18
giveaway even if you left a comment on
- 0:20
the original and lastly I just want to
- 0:22
take a second to say thank you for
- 0:23
supporting the channel
- 0:24
20:19 has already exceeded my
- 0:25
expectations and the video ID list seems
- 0:27
to get longer and longer just don't
- 0:29
expect any Robo color tutorials anytime
- 0:31
soon
- 0:35
- call me ASAP as possible Thanks
- 0:38
Americans get at least 5 billion spam
- 0:40
robo calls per month and that number
- 0:42
gets bigger and bigger every year
- 0:43
personally I get at least 10 of those
- 0:45
calls per day and I finally just decided
- 0:47
if you can't beat them join them in
- 0:49
today's video we're going to not build a
- 0:51
robo caller music and a brand new cloud
- 0:53
function type from firebase but more
- 0:55
importantly we're going to build a task
- 0:56
runner that allows us to schedule any
- 0:58
back-end code to run at any time if
- 1:00
you're new here like and subscribe and
- 1:01
you can find the whole source code on
- 1:03
fire ship IO and leave a comment below
- 1:05
for a chance to win this one-of-a-kind
- 1:06
t-shirt next week so firebase released a
- 1:08
new function type a couple days ago it's
- 1:10
a pub sub function which allows you to
- 1:12
pass messages in between Google services
- 1:14
that is also integrated with Google
- 1:16
cloud scheduler this means you can run
- 1:18
any back-end code at a specific point in
- 1:19
time using a cron tab schedule this is
- 1:22
great if you know exactly when you want
- 1:23
to schedule a job in advance but I want
- 1:25
to push things a step further by
- 1:26
integrating firestore to create a
- 1:28
dynamic task runner that allows you to
- 1:30
schedule a job at any point in time that
- 1:32
allows you or your users to schedule
- 1:33
anything dynamically such as
- 1:35
notifications reminders or as we'll see
- 1:37
soon definitely not robocallers make
- 1:40
sure you have the latest version of
- 1:41
firebase tools installed version 6.7 or
- 1:43
version 2.3 of the firebase functions
- 1:46
module from there we can initialize a
- 1:49
new project by running firebase and it
- 1:50
functions I'll be using typescript and
- 1:52
you'll see why it's so valuable for a
- 1:54
project like this in a few minutes let's
- 1:56
start by taking a look at a basic
- 1:57
schedule pub/sub function in the index
- 1:59
TS i have a reference to the admin SDK


