Skip to content

Commit

Permalink
Use https.request correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeFoodPixels committed Nov 28, 2022
1 parent 8752665 commit 5ba50b2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions netlify/functions/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ const { request } = require("node:https");
const { schedule } = require("@netlify/functions");
// const { cron } = require("../../dist/nextbuild.json");

exports.handler = schedule("00 14 28 11 1", (event, context) => {
exports.handler = schedule("37 14 28 11 1", (event, context) => {
const options = {
hostname: "api.netlify.com",
path: `/build_hooks/${process.env.BUILD_HOOK}`,
method: "POST",
};

request(options, (res) => {
const req = request(options, (res) => {
console.log("statusCode:", res.statusCode);
console.log("headers:", res.headers);

Expand All @@ -22,4 +22,8 @@ exports.handler = schedule("00 14 28 11 1", (event, context) => {
console.error(e);
});
req.end();

return {
statusCode: 200,
};
});

0 comments on commit 5ba50b2

Please sign in to comment.