- - This edge function has crashed -
-An unhandled error in the edge function code triggered the following message:
- -
-
-
- diff --git a/src/lib/functions/synchronous.js b/src/lib/functions/synchronous.js index 530a00dd6fd..2af21d4d5af 100644 --- a/src/lib/functions/synchronous.js +++ b/src/lib/functions/synchronous.js @@ -50,7 +50,9 @@ const processRenderedResponse = async (err, request) => { const acceptsHtml = request.headers && request.headers.accept && request.headers.accept.includes('text/html') const errorString = typeof err === 'string' ? err : formatLambdaLocalError(err, acceptsHtml) - return acceptsHtml ? await renderErrorTemplate(errorString, './templates/function-error.html') : errorString + return acceptsHtml + ? await renderErrorTemplate(errorString, './templates/function-error.html', 'function') + : errorString } const handleErr = async (err, request, response) => { diff --git a/src/lib/render-error-remplate.js b/src/lib/render-error-remplate.js index 09c96a0a7d8..766f153b666 100644 --- a/src/lib/render-error-remplate.js +++ b/src/lib/render-error-remplate.js @@ -3,12 +3,12 @@ const { join } = require('path') let errorTemplateFile -const renderErrorTemplate = async (errString, templatePath) => { - const regexPattern = //g - +const renderErrorTemplate = async (errString, templatePath, functionType) => { + const errorDetailsRegex = //g + const functionTypeRegex = //g try { errorTemplateFile = errorTemplateFile || (await readFile(join(__dirname, templatePath), 'utf-8')) - return errorTemplateFile.replace(regexPattern, errString) + return errorTemplateFile.replace(errorDetailsRegex, errString).replace(functionTypeRegex, functionType) } catch { return errString } diff --git a/src/lib/templates/edge-function-error.html b/src/lib/templates/edge-function-error.html deleted file mode 100644 index 6187cd6846c..00000000000 --- a/src/lib/templates/edge-function-error.html +++ /dev/null @@ -1,289 +0,0 @@ - - -
-An unhandled error in the edge function code triggered the following message:
- -
-
-
- An unhandled error in the function code triggered the following message:
-
-
-
-
-
-
-