File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ const loadProbot = (plugin) => {
22
22
23
23
module . exports . serverless = ( plugin ) => {
24
24
25
- return ( event , context , callback ) => {
25
+ return async ( event , context ) => {
26
26
27
27
// 🤖 A friendly homepage if there isn't a payload
28
28
if ( event . httpMethod === 'GET' && event . path === '/probot' ) {
@@ -33,7 +33,7 @@ module.exports.serverless = (plugin) => {
33
33
} ,
34
34
body : template
35
35
}
36
- return callback ( null , res )
36
+ return context . done ( null , res )
37
37
}
38
38
39
39
// Otherwise let's listen handle the payload
@@ -53,21 +53,20 @@ module.exports.serverless = (plugin) => {
53
53
console . log ( `Received event ${ e } ${ event . body . action ? ( '.' + event . body . action ) : '' } ` )
54
54
if ( event ) {
55
55
try {
56
- probot . receive ( {
56
+ await probot . receive ( {
57
57
event : e ,
58
58
payload : event . body
59
- } ) . then ( ( ) => {
60
- const res = {
61
- statusCode : 200 ,
62
- body : JSON . stringify ( {
63
- message : 'Executed'
64
- } )
65
- }
66
- return callback ( null , res )
67
59
} )
60
+ const res = {
61
+ statusCode : 200 ,
62
+ body : JSON . stringify ( {
63
+ message : 'Hi Node8!'
64
+ } )
65
+ }
66
+ return context . done ( null , res )
68
67
} catch ( err ) {
69
68
console . error ( err )
70
- callback ( err )
69
+ return err
71
70
}
72
71
} else {
73
72
console . error ( { event, context } )
You can’t perform that action at this time.
0 commit comments