Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

fix #15 issue ('Cannot read property 'hasOwnProperty' of null') #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,14 @@ function convertCrontabs() {
for (const funcName in this.serverless.service.functions) {
for (const eventIndex in this.serverless.service.functions[funcName]
.events) {
const event = this.serverless.service.functions[funcName].events[
const schedule = this.serverless.service.functions[funcName].events[
eventIndex
];
// only process events with a schedule & a timezone
if (
event.hasOwnProperty("schedule") &&
event.schedule.hasOwnProperty("timezone")
schedule.hasOwnProperty("rate") &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

schedule.hasOwnProperty("timezone")
) {
const schedule = event.schedule;
const match = schedule.rate.match(/^cron\((.*)\)$/);
if (!match)
// skip rate() schedules
Expand Down