@schedulekit/firebase
TypeScript icon, indicating that this package has built-in type declarations

0.10.0 • Public • Published

Schedule Kit

🚧 Work in progress

Setting Up

First, follow these steps to create Cloud Tasks queue, set up and deploy schedule function:

  1. Make sure you have created a Firebase project and initialized Firebase Functions.

  2. Enable Cloud Tasks API

  3. Create a queue. Note that the queue name and the region will be required to set up the Schedule Kit.

  4. 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!");
    });
  5. Deploy the functions

Executions recovery

Create a composite index with the given settings to enable executions recovery:

  • Collection: executions
  • Fields:
    • state: Ascending
    • startedAt: Ascending
  • Query scope: Collection group

Package Sidebar

Install

npm i @schedulekit/firebase

Weekly Downloads

3

Version

0.10.0

License

UNLICENSED

Unpacked Size

35.8 kB

Total Files

8

Last publish

Collaborators

  • kossnocorp