Oh wait… it probably expects a global. What happens if you initialize it as it asks, in the construc
Oh wait… it probably expects a global. What happens if you initialize it as it asks, in the constructor?
const apiKey as a global var in a ts file under packages/api/src/routes
When the schedule interval is more than 1 hour, a scheduled Worker may run for up to 15 minutes.. My job runs once per month. constructor({
apiKey = Core.readEnv('OPENAI_API_KEY'),
organization = Core.readEnv('OPENAI_ORG_ID') ?? null,
...opts
}: ClientOptions = {}) {const apiKey = process.env.OPENAI_API_KEY
const organization = process.env.OPENAI_ORG_ID
const openai = new OpenAI({ apiKey, organization })