Skip to content

Commit

Permalink
Fix for attempt to process undefined events property
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergii Kovalev committed Mar 24, 2020
1 parent 3747af7 commit d1e14a4
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions src/ServerlessOffline.js
Expand Up @@ -291,25 +291,27 @@ export default class ServerlessOffline {

const events = service.getAllEventsInFunction(functionKey)

events.forEach((event) => {
const { http, schedule, websocket } = event

if (http) {
httpEvents.push({
functionKey,
handler: functionDefinition.handler,
http,
})
}

if (schedule) {
scheduleEvents.push({ functionKey, schedule })
}

if (websocket) {
webSocketEvents.push({ functionKey, websocket })
}
})
if (events) {
events.forEach((event) => {
const { http, schedule, websocket } = event

if (http) {
httpEvents.push({
functionKey,
handler: functionDefinition.handler,
http,
})
}

if (schedule) {
scheduleEvents.push({ functionKey, schedule })
}

if (websocket) {
webSocketEvents.push({ functionKey, websocket })
}
})
}
})

return {
Expand Down

0 comments on commit d1e14a4

Please sign in to comment.