From ab4a681a991603d9e8a712a19ff3d0caa022ef21 Mon Sep 17 00:00:00 2001 From: Thomas Hamer Date: Thu, 22 Sep 2022 22:17:00 +1000 Subject: [PATCH 1/7] add in a try catch block for copy of the healthcheck --- lib/utils/log-deprecation.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/utils/log-deprecation.js b/lib/utils/log-deprecation.js index 3551682946d..d682882c079 100644 --- a/lib/utils/log-deprecation.js +++ b/lib/utils/log-deprecation.js @@ -144,7 +144,11 @@ module.exports.printSummary = async () => { fse.ensureDir(path.dirname(healthStatusFilename)), fsp.writeFile(tmpHealthStatusFilename, healthStatus.join('\n')), ]); - await safeMoveFile(tmpHealthStatusFilename, healthStatusFilename); + try { + await safeMoveFile(tmpHealthStatusFilename, healthStatusFilename); + } catch (e) { + console.log(e); + } } finally { bufferedDeprecations.length = 0; } From 9061096278dd012ff691416fc9de2458e675621e Mon Sep 17 00:00:00 2001 From: Thomas Hamer <48810100+THOM-AwS@users.noreply.github.com> Date: Thu, 22 Sep 2022 22:55:11 +1000 Subject: [PATCH 2/7] Update log-deprecation.js --- lib/utils/log-deprecation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/utils/log-deprecation.js b/lib/utils/log-deprecation.js index d682882c079..3ccaa294062 100644 --- a/lib/utils/log-deprecation.js +++ b/lib/utils/log-deprecation.js @@ -146,8 +146,8 @@ module.exports.printSummary = async () => { ]); try { await safeMoveFile(tmpHealthStatusFilename, healthStatusFilename); - } catch (e) { - console.log(e); + } catch (error) { + log.error('Cannot store information on approached deprecation. Please ensure process has the write access to ~/.servelress directory') } } finally { bufferedDeprecations.length = 0; From c3234396b7595f684a329020c487a304bda0ad46 Mon Sep 17 00:00:00 2001 From: Thomas Hamer <48810100+THOM-AwS@users.noreply.github.com> Date: Thu, 22 Sep 2022 23:05:31 +1000 Subject: [PATCH 3/7] Update log-deprecation.js --- lib/utils/log-deprecation.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/utils/log-deprecation.js b/lib/utils/log-deprecation.js index 3ccaa294062..57132633f5c 100644 --- a/lib/utils/log-deprecation.js +++ b/lib/utils/log-deprecation.js @@ -147,7 +147,9 @@ module.exports.printSummary = async () => { try { await safeMoveFile(tmpHealthStatusFilename, healthStatusFilename); } catch (error) { - log.error('Cannot store information on approached deprecation. Please ensure process has the write access to ~/.servelress directory') + if (error instanceof EACCESS) { + log.error('Cannot store information on approached deprecation. Please ensure process has the write access to ~/.servelress directory') + } } } finally { bufferedDeprecations.length = 0; From 7727ce44fd63ee460470a416a5853d86cea53ee9 Mon Sep 17 00:00:00 2001 From: Thomas Hamer <48810100+THOM-AwS@users.noreply.github.com> Date: Thu, 22 Sep 2022 23:10:47 +1000 Subject: [PATCH 4/7] Update log-deprecation.js --- lib/utils/log-deprecation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils/log-deprecation.js b/lib/utils/log-deprecation.js index 57132633f5c..95e180eb6f1 100644 --- a/lib/utils/log-deprecation.js +++ b/lib/utils/log-deprecation.js @@ -147,7 +147,7 @@ module.exports.printSummary = async () => { try { await safeMoveFile(tmpHealthStatusFilename, healthStatusFilename); } catch (error) { - if (error instanceof EACCESS) { + if (error instanceof EACCES) { log.error('Cannot store information on approached deprecation. Please ensure process has the write access to ~/.servelress directory') } } From 548d949c6c031926bc40eb322736a7a4c9a8ba5c Mon Sep 17 00:00:00 2001 From: Thomas Hamer <48810100+THOM-AwS@users.noreply.github.com> Date: Thu, 22 Sep 2022 23:21:56 +1000 Subject: [PATCH 5/7] Update log-deprecation.js --- lib/utils/log-deprecation.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/utils/log-deprecation.js b/lib/utils/log-deprecation.js index 95e180eb6f1..aaddb4b330b 100644 --- a/lib/utils/log-deprecation.js +++ b/lib/utils/log-deprecation.js @@ -147,8 +147,10 @@ module.exports.printSummary = async () => { try { await safeMoveFile(tmpHealthStatusFilename, healthStatusFilename); } catch (error) { - if (error instanceof EACCES) { - log.error('Cannot store information on approached deprecation. Please ensure process has the write access to ~/.servelress directory') + if (error.code === 'EACCES'){ + log.error('Cannot store information on approached deprecation. Please ensure process has write access to the ~/.servelress directory'); + } else { + log.error('An error occurred when copying the health status to the ~.serverless directory'); } } } finally { From 6f9c1c090bbd526447a0be676315dd9a0baf2248 Mon Sep 17 00:00:00 2001 From: Thomas Hamer <48810100+THOM-AwS@users.noreply.github.com> Date: Thu, 22 Sep 2022 23:26:51 +1000 Subject: [PATCH 6/7] Update log-deprecation.js --- lib/utils/log-deprecation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils/log-deprecation.js b/lib/utils/log-deprecation.js index aaddb4b330b..e071ccb8a9c 100644 --- a/lib/utils/log-deprecation.js +++ b/lib/utils/log-deprecation.js @@ -150,7 +150,7 @@ module.exports.printSummary = async () => { if (error.code === 'EACCES'){ log.error('Cannot store information on approached deprecation. Please ensure process has write access to the ~/.servelress directory'); } else { - log.error('An error occurred when copying the health status to the ~.serverless directory'); + throw error; } } } finally { From 64cfc75759cb3624c112f123e68feb5ad4b786db Mon Sep 17 00:00:00 2001 From: Thomas Hamer Date: Fri, 23 Sep 2022 00:12:14 +1000 Subject: [PATCH 7/7] formatting and spelling --- lib/utils/log-deprecation.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/utils/log-deprecation.js b/lib/utils/log-deprecation.js index e071ccb8a9c..8f4524ac2d1 100644 --- a/lib/utils/log-deprecation.js +++ b/lib/utils/log-deprecation.js @@ -147,8 +147,10 @@ module.exports.printSummary = async () => { try { await safeMoveFile(tmpHealthStatusFilename, healthStatusFilename); } catch (error) { - if (error.code === 'EACCES'){ - log.error('Cannot store information on approached deprecation. Please ensure process has write access to the ~/.servelress directory'); + if (error.code === 'EACCES') { + log.error( + 'Cannot store information on approached deprecation. Please ensure process has write access to the ~/.serverless directory' + ); } else { throw error; }