@@ -176,18 +176,18 @@ export class NgrokInstance {
176176 return { inspectUrl : this . inspectUrl } ;
177177 }
178178 this . ngrokProcess = this . spawnNgrok ( opts ) ;
179- // If we do not receive a ready state from ngrok within 15 seconds, emit and reject
179+ // If we do not receive a ready state from ngrok within 40 seconds, emit and reject
180180 this . inspectUrl = await new Promise < string > ( ( resolve , reject ) => {
181181 const timeout = setTimeout ( ( ) => {
182- const message = 'Failed to receive a ready state from ngrok within 15 seconds.' ;
182+ const message = 'Failed to receive a ready state from ngrok within 40 seconds.' ;
183183 this . ngrokEmitter . emit ( 'error' , message ) ;
184184 reject ( message ) ;
185- } , 15000 ) ;
185+ } , 40000 ) ;
186186
187187 /**
188188 * Look for an address in the many messages
189189 * sent by ngrok or fail if one does not arrive
190- * in 15 seconds.
190+ * in 40 seconds.
191191 */
192192 const onNgrokData = ( data : Buffer ) => {
193193 const addr = data . toString ( ) . match ( addrRegExp ) ;
@@ -200,7 +200,9 @@ export class NgrokInstance {
200200 } ;
201201
202202 this . ngrokProcess . stdout . on ( 'data' , onNgrokData ) ;
203- process . on ( 'exit' , this . kill ) ;
203+ process . on ( 'exit' , ( ) => {
204+ this . kill ( ) ;
205+ } ) ;
204206 } ) ;
205207 return { inspectUrl : this . inspectUrl } ;
206208 }
@@ -291,7 +293,11 @@ export class NgrokInstance {
291293 this . ws . write ( data . toString ( ) + '\n' ) ;
292294 } ) ;
293295
294- ngrok . stderr . on ( 'data' , ( data : Buffer ) => this . ngrokEmitter . emit ( 'error' , this . ws . write ( data . toString ( ) ) ) ) ;
296+ ngrok . stderr . on ( 'data' , ( data : Buffer ) =>
297+ this . ngrokEmitter . emit ( 'error' , ( ) => {
298+ this . ws . write ( data . toString ( ) ) ;
299+ } )
300+ ) ;
295301 return ngrok ;
296302 } catch ( e ) {
297303 throw e ;
0 commit comments