Scheduled background function is being deployed but not executing

Hello,

I have a a scheduled background function called test-background.ts. It is being deployed correctly to netlify. But never executing. I can’t tell why.

import { Config, Context } from "@netlify/functions";

export async function handler(req: any, context: Context) {
  try {
    console.log("Executing function with context: ", context);
    return {
      statusCode: 200,
      body: "Pushed appfollow interactions successfully.",
    };
  } catch (err) {
    return {
      statusCode: 500,
    };
  }
}
export const config: Config = {
  schedule: "*/5 * * * *",
};

In my netlify.toml I also try adding the function

[build]
  command = "npm run build"
  publish = ".next"
[functions."test-background"]
schedule = "*/5 * * * *"

Hi @charleslenx,

Thanks for reaching out and welcome to Netlify’s Support Forums!

We have a debugging section for Schedule functions here:

If you could give that a read to see if it helps.

Additionally, you’ll want to be aware of the limitations:

If you continue to have issues, could you provide the site you’re attempting to use the functions on? For example, sitename.netlify.app.

Fixed. It was due to site password. A warning is needed for this when putting a site password. Thank you.

hi @charleslenx :wave:t6: thanks for writing that you found your solution. We’ve detailed what this means in our docs page below.