skip to Main Content

I am migrating some scheduler functions from 1st to 2nd gen. While the documentation talks about passing runtime options to other types of functions like onRequest and onCall, I do not see the equivalent for onSchedule. The first argument is the schedule itself and the second is the handler.

So how do I specify things like vpcConnector and memory?

I do not want to use the setGlobalOptions function because not everything I want to set should affect all functions globally.

2

Answers


  1. The first argument can be a schedule string but it can also be an object with arguments:

    exports.schedule = onSchedule({
      schedule: 'every day 00:00',
      memory: '1GiB',
      ... etc
    }, async (event) => {
      ...
    })
    

    You can find all props available on ScheduleOptions interface wich extends GlobalOptions interface.

    Login or Signup to reply.
  2. See the API documentation. There are two variants of onSchedule. You want the one that takes ScheduleOptions as a first parameter. ScheduleOptions lets you provide the schedule as a property, along with all of the properties inherited from GlobalOptions. GlobalOptions accepts vpcConnector and memory.

    exports.mySchedule = onSchedule({
        schedule: "...",
        vpcConnector: "...",
        memory: ...
    }, ...)
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search