From 578aad60affe6ad2ac54fd999e140f35a1296642 Mon Sep 17 00:00:00 2001 From: Jackie Macharia Date: Thu, 9 Jun 2022 16:05:17 +0300 Subject: [PATCH 01/13] fix: gracefully fail in case deno binary issue --- src/lib/edge-functions/proxy.js | 87 ++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 33 deletions(-) diff --git a/src/lib/edge-functions/proxy.js b/src/lib/edge-functions/proxy.js index d0cd1cc4e48..f0920c6aeb1 100644 --- a/src/lib/edge-functions/proxy.js +++ b/src/lib/edge-functions/proxy.js @@ -5,7 +5,7 @@ const { cwd, env } = require('process') const getAvailablePort = require('get-port') const { v4: generateUUID } = require('uuid') -const { NETLIFYDEVERR, NETLIFYDEVWARN, chalk, log } = require('../../utils/command-helpers') +const { BANG, NETLIFYDEVERR, NETLIFYDEVWARN, chalk, log } = require('../../utils/command-helpers') const { getGeoLocation } = require('../geo-location') const { getPathInProject } = require('../settings') const { startSpinner, stopSpinner } = require('../spinner') @@ -22,8 +22,11 @@ const LOCAL_HOST = '127.0.0.1' const getDownloadUpdateFunctions = () => { let spinner - const onAfterDownload = () => { - stopSpinner({ spinner }) + /** + * @param {boolean} hasError + */ + const onAfterDownload = (hasError) => { + stopSpinner({ error: hasError, spinner }) } const onBeforeDownload = () => { @@ -80,18 +83,22 @@ const initializeProxy = async ({ return } - const [geoLocation, { registry }] = await Promise.all([ + const [geoLocation, preppedServer] = await Promise.all([ getGeoLocation({ mode: geolocationMode, offline, state }), server, ]) + if (preppedServer instanceof Error) { + return + } + // Setting header with geolocation. req.headers[headers.Geo] = JSON.stringify(geoLocation) - await registry.initialize() + await preppedServer.registry.initialize() const url = new URL(req.url, `http://${LOCAL_HOST}:${mainPort}`) - const { functionNames, orphanedDeclarations } = await registry.matchURLPath(url.pathname) + const { functionNames, orphanedDeclarations } = await preppedServer.registry.matchURLPath(url.pathname) // If the request matches a config declaration for an Edge Function without // a matching function file, we warn the user. @@ -141,34 +148,48 @@ const prepareServer = async ({ port, projectDir, }) => { - const bundler = await import('@netlify/edge-bundler') - const distImportMapPath = getPathInProject([DIST_IMPORT_MAP_PATH]) - const runIsolate = await bundler.serve({ - ...getDownloadUpdateFunctions(), - certificatePath, - debug: env.NETLIFY_DENO_DEBUG === 'true', - distImportMapPath, - formatExportTypeError: (name) => - `${NETLIFYDEVERR} ${chalk.red('Failed')} to load Edge Function ${chalk.yellow( - name, - )}. The file does not seem to have a function as the default export.`, - formatImportError: (name) => `${NETLIFYDEVERR} ${chalk.red('Failed')} to run Edge Function ${chalk.yellow(name)}:`, - importMaps, - inspectSettings, - port, - }) - const registry = new EdgeFunctionsRegistry({ - bundler, - config, - configPath, - directories, - getUpdatedConfig, - internalFunctions, - projectDir, - runIsolate, - }) + try { + const bundler = await import('@netlify/edge-bundler') + const distImportMapPath = getPathInProject([DIST_IMPORT_MAP_PATH]) + const runIsolate = await bundler.serve({ + ...getDownloadUpdateFunctions(), + certificatePath, + debug: env.NETLIFY_DENO_DEBUG === 'true', + distImportMapPath, + formatExportTypeError: (name) => + `${NETLIFYDEVERR} ${chalk.red('Failed')} to load Edge Function ${chalk.yellow( + name, + )}. The file does not seem to have a function as the default export.`, + formatImportError: (name) => `${NETLIFYDEVERR} ${chalk.red('Failed')} to run Edge Function ${chalk.yellow(name)}:`, + importMaps, + inspectSettings, + port, + }) + const registry = new EdgeFunctionsRegistry({ + bundler, + config, + configPath, + directories, + getUpdatedConfig, + internalFunctions, + projectDir, + runIsolate, + }) - return { registry, runIsolate } + return { registry, runIsolate } + } catch (error) { + log( + `${chalk.red( + BANG, + )} There was a problem setting up the Edge Functions environment and you unfortunately be able to use Edge Functions from CLI. More on supported platforms here: https://deno.land/manual/getting_started/installation. Error: ${ + error.message + }`, + ) + + // return the error so we can listen for the error instance and break execution in initializeProxy() + // using this instead of throw allows us to continue using netlify dev command if we run into a deno binary error + return error + } } module.exports = { handleProxyRequest, initializeProxy, isEdgeFunctionsRequest } From b5ed9ce441caf06963e3d829b918595bd51a37fd Mon Sep 17 00:00:00 2001 From: Jackie Macharia Date: Thu, 9 Jun 2022 16:06:52 +0300 Subject: [PATCH 02/13] fix: fix linting --- src/lib/edge-functions/proxy.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/edge-functions/proxy.js b/src/lib/edge-functions/proxy.js index f0920c6aeb1..841c9ccba99 100644 --- a/src/lib/edge-functions/proxy.js +++ b/src/lib/edge-functions/proxy.js @@ -160,7 +160,8 @@ const prepareServer = async ({ `${NETLIFYDEVERR} ${chalk.red('Failed')} to load Edge Function ${chalk.yellow( name, )}. The file does not seem to have a function as the default export.`, - formatImportError: (name) => `${NETLIFYDEVERR} ${chalk.red('Failed')} to run Edge Function ${chalk.yellow(name)}:`, + formatImportError: (name) => + `${NETLIFYDEVERR} ${chalk.red('Failed')} to run Edge Function ${chalk.yellow(name)}:`, importMaps, inspectSettings, port, From 06b3f6478cf8653ad13baa92297f7bf511f53da1 Mon Sep 17 00:00:00 2001 From: Jackie Macharia Date: Thu, 9 Jun 2022 17:33:11 +0300 Subject: [PATCH 03/13] fix: fix typo --- src/lib/edge-functions/proxy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/edge-functions/proxy.js b/src/lib/edge-functions/proxy.js index 841c9ccba99..1dc576e949b 100644 --- a/src/lib/edge-functions/proxy.js +++ b/src/lib/edge-functions/proxy.js @@ -182,7 +182,7 @@ const prepareServer = async ({ log( `${chalk.red( BANG, - )} There was a problem setting up the Edge Functions environment and you unfortunately be able to use Edge Functions from CLI. More on supported platforms here: https://deno.land/manual/getting_started/installation. Error: ${ + )} There was a problem setting up the Edge Functions environment and you unfortunately won't be able to run Edge Functions from CLI. More on supported platforms here: https://deno.land/manual/getting_started/installation. Error: ${ error.message }`, ) From 48c8101dbb4e802c848b605ede417a096a3f1668 Mon Sep 17 00:00:00 2001 From: Jackie Macharia Date: Thu, 9 Jun 2022 18:48:59 +0300 Subject: [PATCH 04/13] fix: update error text Co-authored-by: Daniel Tschinder <231804+danez@users.noreply.github.com> --- src/lib/edge-functions/proxy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/edge-functions/proxy.js b/src/lib/edge-functions/proxy.js index 1dc576e949b..4d5414ed959 100644 --- a/src/lib/edge-functions/proxy.js +++ b/src/lib/edge-functions/proxy.js @@ -182,7 +182,7 @@ const prepareServer = async ({ log( `${chalk.red( BANG, - )} There was a problem setting up the Edge Functions environment and you unfortunately won't be able to run Edge Functions from CLI. More on supported platforms here: https://deno.land/manual/getting_started/installation. Error: ${ + )} There was a problem setting up the Edge Functions environment and it's unfortunately not possible to run Edge Functions from the CLI on this platform. More on supported platforms here: https://deno.land/manual/getting_started/installation. Error: ${ error.message }`, ) From aae01e04e43ed533acf4a626a768503769e9c7fd Mon Sep 17 00:00:00 2001 From: Jackie Macharia Date: Tue, 14 Jun 2022 16:04:07 +0300 Subject: [PATCH 05/13] fix: move error message to edge-bundler --- src/lib/edge-functions/proxy.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/lib/edge-functions/proxy.js b/src/lib/edge-functions/proxy.js index 4d5414ed959..03ae2154a86 100644 --- a/src/lib/edge-functions/proxy.js +++ b/src/lib/edge-functions/proxy.js @@ -179,14 +179,6 @@ const prepareServer = async ({ return { registry, runIsolate } } catch (error) { - log( - `${chalk.red( - BANG, - )} There was a problem setting up the Edge Functions environment and it's unfortunately not possible to run Edge Functions from the CLI on this platform. More on supported platforms here: https://deno.land/manual/getting_started/installation. Error: ${ - error.message - }`, - ) - // return the error so we can listen for the error instance and break execution in initializeProxy() // using this instead of throw allows us to continue using netlify dev command if we run into a deno binary error return error From 5066fba9c318438f5228beabc627e71d70056e21 Mon Sep 17 00:00:00 2001 From: Jackie Macharia Date: Tue, 14 Jun 2022 16:12:13 +0300 Subject: [PATCH 06/13] fix: log error --- src/lib/edge-functions/proxy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/edge-functions/proxy.js b/src/lib/edge-functions/proxy.js index 03ae2154a86..4f2e807fbdc 100644 --- a/src/lib/edge-functions/proxy.js +++ b/src/lib/edge-functions/proxy.js @@ -179,6 +179,7 @@ const prepareServer = async ({ return { registry, runIsolate } } catch (error) { + log(`${chalk.red(BANG)} ${error.message}`) // return the error so we can listen for the error instance and break execution in initializeProxy() // using this instead of throw allows us to continue using netlify dev command if we run into a deno binary error return error From 86254fe2304b2b1a6acb54dddce012ca1384423a Mon Sep 17 00:00:00 2001 From: jackiewmacharia Date: Tue, 14 Jun 2022 13:13:33 +0000 Subject: [PATCH 07/13] chore: update contributors field --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 597ec8434e3..25e36667eaa 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "Eduardo Bouças (https://twitter.com/eduardoboucas)", "Emily Zhang (https://twitter.com/mlylzhng)", "Erez Rokah (https://www.erezro.com)", + "Erica Pisani ", "Evans Hauser (https://twitter.com/evanshauser)", "Finn Woelm (https://twitter.com/FinnWoelm)", "Flxbot", From de3c686074882a2d9c7c4c31d7681b9119ffdfc3 Mon Sep 17 00:00:00 2001 From: Jackie Macharia Date: Wed, 15 Jun 2022 11:31:20 +0300 Subject: [PATCH 08/13] fix: get spinner stae from error object --- src/lib/edge-functions/proxy.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/edge-functions/proxy.js b/src/lib/edge-functions/proxy.js index 4f2e807fbdc..1ec899be63e 100644 --- a/src/lib/edge-functions/proxy.js +++ b/src/lib/edge-functions/proxy.js @@ -23,10 +23,10 @@ const getDownloadUpdateFunctions = () => { let spinner /** - * @param {boolean} hasError + * @param {Error | null} error */ - const onAfterDownload = (hasError) => { - stopSpinner({ error: hasError, spinner }) + const onAfterDownload = (error) => { + stopSpinner({ error: Boolean(error), spinner }) } const onBeforeDownload = () => { From 6c2f344982884ade0ec9e05dee4c31e7c7ad6a7c Mon Sep 17 00:00:00 2001 From: Jackie Macharia Date: Wed, 15 Jun 2022 22:32:36 +0300 Subject: [PATCH 09/13] chore: move error handling to initializeProxy and use custom error logger --- src/lib/edge-functions/proxy.js | 171 ++++++++++++++++---------------- 1 file changed, 83 insertions(+), 88 deletions(-) diff --git a/src/lib/edge-functions/proxy.js b/src/lib/edge-functions/proxy.js index 1ec899be63e..454a77512b6 100644 --- a/src/lib/edge-functions/proxy.js +++ b/src/lib/edge-functions/proxy.js @@ -1,11 +1,12 @@ // @ts-check const { relative } = require('path') const { cwd, env } = require('process') +const { format } = require('util') const getAvailablePort = require('get-port') const { v4: generateUUID } = require('uuid') -const { BANG, NETLIFYDEVERR, NETLIFYDEVWARN, chalk, log } = require('../../utils/command-helpers') +const { NETLIFYDEVERR, NETLIFYDEVWARN, chalk, error, log } = require('../../utils/command-helpers') const { getGeoLocation } = require('../geo-location') const { getPathInProject } = require('../settings') const { startSpinner, stopSpinner } = require('../spinner') @@ -23,10 +24,10 @@ const getDownloadUpdateFunctions = () => { let spinner /** - * @param {Error | null} error + * @param {Error | null} error_ */ - const onAfterDownload = (error) => { - stopSpinner({ error: Boolean(error), spinner }) + const onAfterDownload = (error_) => { + stopSpinner({ error: Boolean(error_), spinner }) } const onBeforeDownload = () => { @@ -77,60 +78,62 @@ const initializeProxy = async ({ projectDir, }) const hasEdgeFunctions = userFunctionsPath !== undefined || internalFunctions.length !== 0 + let hasServerError = false return async (req) => { - if (req.headers[headers.Passthrough] !== undefined || !hasEdgeFunctions) { + if (req.headers[headers.Passthrough] !== undefined || !hasEdgeFunctions || hasServerError) { return } - const [geoLocation, preppedServer] = await Promise.all([ - getGeoLocation({ mode: geolocationMode, offline, state }), - server, - ]) - - if (preppedServer instanceof Error) { - return - } - - // Setting header with geolocation. - req.headers[headers.Geo] = JSON.stringify(geoLocation) - - await preppedServer.registry.initialize() - - const url = new URL(req.url, `http://${LOCAL_HOST}:${mainPort}`) - const { functionNames, orphanedDeclarations } = await preppedServer.registry.matchURLPath(url.pathname) - - // If the request matches a config declaration for an Edge Function without - // a matching function file, we warn the user. - orphanedDeclarations.forEach((functionName) => { - log( - `${NETLIFYDEVWARN} Request to ${chalk.yellow( - url.pathname, - )} matches declaration for edge function ${chalk.yellow( - functionName, - )}, but there's no matching function file in ${chalk.yellow( - relative(cwd(), userFunctionsPath), - )}. Please visit ${chalk.blue('https://ntl.fyi/edge-create')} for more information.`, - ) - }) - - if (functionNames.length === 0) { - return + try { + const [geoLocation, { registry }] = await Promise.all([ + getGeoLocation({ mode: geolocationMode, offline, state }), + server, + ]) + + // Setting header with geolocation. + req.headers[headers.Geo] = JSON.stringify(geoLocation) + + await registry.initialize() + + const url = new URL(req.url, `http://${LOCAL_HOST}:${mainPort}`) + const { functionNames, orphanedDeclarations } = await registry.matchURLPath(url.pathname) + + // If the request matches a config declaration for an Edge Function without + // a matching function file, we warn the user. + orphanedDeclarations.forEach((functionName) => { + log( + `${NETLIFYDEVWARN} Request to ${chalk.yellow( + url.pathname, + )} matches declaration for edge function ${chalk.yellow( + functionName, + )}, but there's no matching function file in ${chalk.yellow( + relative(cwd(), userFunctionsPath), + )}. Please visit ${chalk.blue('https://ntl.fyi/edge-create')} for more information.`, + ) + }) + + if (functionNames.length === 0) { + return + } + + req[headersSymbol] = { + [headers.Functions]: functionNames.join(','), + [headers.ForwardedHost]: `localhost:${mainPort}`, + [headers.Passthrough]: 'passthrough', + [headers.RequestID]: generateUUID(), + [headers.IP]: LOCAL_HOST, + } + + if (settings.https) { + req[headersSymbol][headers.ForwardedProtocol] = 'https' + } + + return `http://${LOCAL_HOST}:${isolatePort}` + } catch (error_) { + error(error_ instanceof Error ? error_ : format(error_), { exit: false }) + hasServerError = true } - - req[headersSymbol] = { - [headers.Functions]: functionNames.join(','), - [headers.ForwardedHost]: `localhost:${mainPort}`, - [headers.Passthrough]: 'passthrough', - [headers.RequestID]: generateUUID(), - [headers.IP]: LOCAL_HOST, - } - - if (settings.https) { - req[headersSymbol][headers.ForwardedProtocol] = 'https' - } - - return `http://${LOCAL_HOST}:${isolatePort}` } } @@ -148,42 +151,34 @@ const prepareServer = async ({ port, projectDir, }) => { - try { - const bundler = await import('@netlify/edge-bundler') - const distImportMapPath = getPathInProject([DIST_IMPORT_MAP_PATH]) - const runIsolate = await bundler.serve({ - ...getDownloadUpdateFunctions(), - certificatePath, - debug: env.NETLIFY_DENO_DEBUG === 'true', - distImportMapPath, - formatExportTypeError: (name) => - `${NETLIFYDEVERR} ${chalk.red('Failed')} to load Edge Function ${chalk.yellow( - name, - )}. The file does not seem to have a function as the default export.`, - formatImportError: (name) => - `${NETLIFYDEVERR} ${chalk.red('Failed')} to run Edge Function ${chalk.yellow(name)}:`, - importMaps, - inspectSettings, - port, - }) - const registry = new EdgeFunctionsRegistry({ - bundler, - config, - configPath, - directories, - getUpdatedConfig, - internalFunctions, - projectDir, - runIsolate, - }) - - return { registry, runIsolate } - } catch (error) { - log(`${chalk.red(BANG)} ${error.message}`) - // return the error so we can listen for the error instance and break execution in initializeProxy() - // using this instead of throw allows us to continue using netlify dev command if we run into a deno binary error - return error - } + const bundler = await import('@netlify/edge-bundler') + const distImportMapPath = getPathInProject([DIST_IMPORT_MAP_PATH]) + const runIsolate = await bundler.serve({ + ...getDownloadUpdateFunctions(), + certificatePath, + debug: env.NETLIFY_DENO_DEBUG === 'true', + distImportMapPath, + formatExportTypeError: (name) => + `${NETLIFYDEVERR} ${chalk.red('Failed')} to load Edge Function ${chalk.yellow( + name, + )}. The file does not seem to have a function as the default export.`, + formatImportError: (name) => `${NETLIFYDEVERR} ${chalk.red('Failed')} to run Edge Function ${chalk.yellow(name)}:`, + importMaps, + inspectSettings, + port, + }) + const registry = new EdgeFunctionsRegistry({ + bundler, + config, + configPath, + directories, + getUpdatedConfig, + internalFunctions, + projectDir, + runIsolate, + }) + + return { registry, runIsolate } } module.exports = { handleProxyRequest, initializeProxy, isEdgeFunctionsRequest } From 1f146aea712c32dc671e5e69a60c059ee8787b16 Mon Sep 17 00:00:00 2001 From: Jackie Macharia Date: Thu, 16 Jun 2022 16:34:33 +0300 Subject: [PATCH 10/13] fix: reduce functionality covered by try/catch --- src/lib/edge-functions/proxy.js | 93 +++++++++++++++++---------------- 1 file changed, 49 insertions(+), 44 deletions(-) diff --git a/src/lib/edge-functions/proxy.js b/src/lib/edge-functions/proxy.js index 454a77512b6..e69e347f4ff 100644 --- a/src/lib/edge-functions/proxy.js +++ b/src/lib/edge-functions/proxy.js @@ -85,55 +85,60 @@ const initializeProxy = async ({ return } + let promiseResult + try { - const [geoLocation, { registry }] = await Promise.all([ - getGeoLocation({ mode: geolocationMode, offline, state }), - server, - ]) - - // Setting header with geolocation. - req.headers[headers.Geo] = JSON.stringify(geoLocation) - - await registry.initialize() - - const url = new URL(req.url, `http://${LOCAL_HOST}:${mainPort}`) - const { functionNames, orphanedDeclarations } = await registry.matchURLPath(url.pathname) - - // If the request matches a config declaration for an Edge Function without - // a matching function file, we warn the user. - orphanedDeclarations.forEach((functionName) => { - log( - `${NETLIFYDEVWARN} Request to ${chalk.yellow( - url.pathname, - )} matches declaration for edge function ${chalk.yellow( - functionName, - )}, but there's no matching function file in ${chalk.yellow( - relative(cwd(), userFunctionsPath), - )}. Please visit ${chalk.blue('https://ntl.fyi/edge-create')} for more information.`, - ) - }) - - if (functionNames.length === 0) { - return - } - - req[headersSymbol] = { - [headers.Functions]: functionNames.join(','), - [headers.ForwardedHost]: `localhost:${mainPort}`, - [headers.Passthrough]: 'passthrough', - [headers.RequestID]: generateUUID(), - [headers.IP]: LOCAL_HOST, - } - - if (settings.https) { - req[headersSymbol][headers.ForwardedProtocol] = 'https' - } - - return `http://${LOCAL_HOST}:${isolatePort}` + promiseResult = await Promise.all([getGeoLocation({ mode: geolocationMode, offline, state }), server]) } catch (error_) { error(error_ instanceof Error ? error_ : format(error_), { exit: false }) hasServerError = true } + + if (promiseResult === undefined) { + return + } + + const [geoLocation, { registry }] = promiseResult + + // Setting header with geolocation. + req.headers[headers.Geo] = JSON.stringify(geoLocation) + + await registry.initialize() + + const url = new URL(req.url, `http://${LOCAL_HOST}:${mainPort}`) + const { functionNames, orphanedDeclarations } = await registry.matchURLPath(url.pathname) + + // If the request matches a config declaration for an Edge Function without + // a matching function file, we warn the user. + orphanedDeclarations.forEach((functionName) => { + log( + `${NETLIFYDEVWARN} Request to ${chalk.yellow( + url.pathname, + )} matches declaration for edge function ${chalk.yellow( + functionName, + )}, but there's no matching function file in ${chalk.yellow( + relative(cwd(), userFunctionsPath), + )}. Please visit ${chalk.blue('https://ntl.fyi/edge-create')} for more information.`, + ) + }) + + if (functionNames.length === 0) { + return + } + + req[headersSymbol] = { + [headers.Functions]: functionNames.join(','), + [headers.ForwardedHost]: `localhost:${mainPort}`, + [headers.Passthrough]: 'passthrough', + [headers.RequestID]: generateUUID(), + [headers.IP]: LOCAL_HOST, + } + + if (settings.https) { + req[headersSymbol][headers.ForwardedProtocol] = 'https' + } + + return `http://${LOCAL_HOST}:${isolatePort}` } } From 9474027e1c26ee93635faf0cc6e1e5abf5ddaa97 Mon Sep 17 00:00:00 2001 From: Jackie Macharia Date: Fri, 17 Jun 2022 19:39:12 +0300 Subject: [PATCH 11/13] fix: clean up catch block --- src/lib/edge-functions/proxy.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/lib/edge-functions/proxy.js b/src/lib/edge-functions/proxy.js index e69e347f4ff..d1d88ff764e 100644 --- a/src/lib/edge-functions/proxy.js +++ b/src/lib/edge-functions/proxy.js @@ -90,11 +90,8 @@ const initializeProxy = async ({ try { promiseResult = await Promise.all([getGeoLocation({ mode: geolocationMode, offline, state }), server]) } catch (error_) { - error(error_ instanceof Error ? error_ : format(error_), { exit: false }) + error(error_.message, { exit: false }) hasServerError = true - } - - if (promiseResult === undefined) { return } From 257cd546440cfddb45230995d8341760949d9b22 Mon Sep 17 00:00:00 2001 From: Jackie Macharia Date: Fri, 17 Jun 2022 19:48:36 +0300 Subject: [PATCH 12/13] fix: fix linting --- src/lib/edge-functions/proxy.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/edge-functions/proxy.js b/src/lib/edge-functions/proxy.js index d1d88ff764e..c0547f02017 100644 --- a/src/lib/edge-functions/proxy.js +++ b/src/lib/edge-functions/proxy.js @@ -1,7 +1,6 @@ // @ts-check const { relative } = require('path') const { cwd, env } = require('process') -const { format } = require('util') const getAvailablePort = require('get-port') const { v4: generateUUID } = require('uuid') From b41906aa4984f79683d3868d381a09a6a92c2dda Mon Sep 17 00:00:00 2001 From: Jackie Macharia Date: Fri, 17 Jun 2022 19:59:52 +0300 Subject: [PATCH 13/13] chore: optional error value for onAfterDownload --- src/lib/edge-functions/proxy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/edge-functions/proxy.js b/src/lib/edge-functions/proxy.js index c0547f02017..f8a0ce7f805 100644 --- a/src/lib/edge-functions/proxy.js +++ b/src/lib/edge-functions/proxy.js @@ -23,7 +23,7 @@ const getDownloadUpdateFunctions = () => { let spinner /** - * @param {Error | null} error_ + * @param {Error=} error_ */ const onAfterDownload = (error_) => { stopSpinner({ error: Boolean(error_), spinner })