@schedulekit/firebase
v0.10.0
Published
Schedule toolkit for Firebase
Downloads
14
Maintainers
Readme
Schedule Kit
🚧 Work in progress
Setting Up
First, follow these steps to create Cloud Tasks queue, set up and deploy schedule function:
Make sure you have created a Firebase project and initialized Firebase Functions.
Create a queue. Note that the queue name and the region will be required to set up the Schedule Kit.
Set up and export a function.
const functions = require("firebase-functions"); // 1. Import the function const { createScheduleKit } = require("@schedulekit/firebase"); // 2. Import firebase-admin const admin = require("firebase-admin"); // 3. Initialize the app admin.initializeApp(); // 4. Set up and export function const { processSchedule } = createScheduleKit("schedule-queue", { region: "asia-southeast1-a", // You can skip options if you use us-central1 }); export { processSchedule }; exports.helloWorld = functions.https.onRequest((request, response) => { functions.logger.info("Hello logs!", { structuredData: true }); response.send("Hello from Firebase!"); });
Deploy the functions
Executions recovery
Create a composite index with the given settings to enable executions recovery:
- Collection:
executions
- Fields:
state
: AscendingstartedAt
: Ascending
- Query scope: Collection group