@@ -60,7 +60,7 @@ export default function init({ projectControl, isPersonal }: Options) {
6060 if ( req . headers [ "cookie" ] != null ) {
6161 let cookie ;
6262 ( { cookie, remember_me, api_key } = stripRememberMeCookie (
63- req . headers [ "cookie" ]
63+ req . headers [ "cookie" ] ,
6464 ) ) ;
6565 req . headers [ "cookie" ] = cookie ;
6666 }
@@ -71,7 +71,7 @@ export default function init({ projectControl, isPersonal }: Options) {
7171 // definitely block access. 4xx since this is a *client* problem.
7272 const url = await siteUrl ( ) ;
7373 throw Error (
74- `Please login to <a target='_blank' href='${ url } '>${ url } </a> with cookies enabled, then refresh this page.`
74+ `Please login to <a target='_blank' href='${ url } '>${ url } </a> with cookies enabled, then refresh this page.` ,
7575 ) ;
7676 }
7777
@@ -94,15 +94,15 @@ export default function init({ projectControl, isPersonal }: Options) {
9494 dbg ( "using cached proxy" ) ;
9595 proxy = cache . get ( target ) ;
9696 } else {
97- dbg ( "make a new proxy server to" , target ) ;
97+ logger . debug ( "make a new proxy server to" , target ) ;
9898 proxy = createProxyServer ( {
9999 ws : false ,
100100 target,
101101 timeout : 60000 ,
102102 } ) ;
103103 // and cache it.
104104 cache . set ( target , proxy ) ;
105- dbg ( "created new proxy" ) ;
105+ logger . debug ( "created new proxy" ) ;
106106 // setup error handler, so that if something goes wrong with this proxy (it will,
107107 // e.g., on project restart), we properly invalidate it.
108108 const remove_from_cache = ( ) => {
@@ -111,11 +111,14 @@ export default function init({ projectControl, isPersonal }: Options) {
111111 } ;
112112
113113 proxy . on ( "error" , ( e ) => {
114- dbg ( "http proxy error event (ending proxy)" , e ) ;
114+ logger . debug ( "http proxy error event (ending proxy)" , e ) ;
115115 remove_from_cache ( ) ;
116116 } ) ;
117117
118- proxy . on ( "close" , remove_from_cache ) ;
118+ proxy . on ( "close" , ( ) => {
119+ logger . debug ( "http proxy close event (ending proxy)" ) ;
120+ remove_from_cache ( ) ;
121+ } ) ;
119122 }
120123
121124 if ( internal_url != null ) {
0 commit comments