You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using runMigration as a library function from another piece of software the expected behaviour would be, that all exceptions raised during the execution of migrations to be thrown to the caller.
Actual Behavior
We are calling runMigration from AWS Lambda functions in order to automate updates of our content models. The issue following issue occurs when an error during the execution of any migration occurs:
That call fails with EROFS: read-only file system, open '/var/task/errors-2-1656322066050.log' as the filesystem is mounted read-only for AWS Lambda handlers.
The rejection of the writeErrorsToLog promise is not caught, resulting in unhandledRejection event to be raised.
The Lambda handler fails without any of the application's catch blocks to be executed.
Possible Solution
I'd suggest the following two adjustments:
Handle errors thrown by writeErrorsToLog.
Do not write error logs in case runMigration is not used as a CLI (shouldThrow === true).
If someone agrees with these steps, I might be able to provide a PR myself.
Steps to Reproduce
Just execute run migrations from a read-only FS or mock writeErrorsToLog to fail.
Context
Environment
AWS Lambda Container:
Node Version: v14.19.2
Package Manager Version: 6.14.17
Operating System: Linux 56fa0daeae18 5.10.76-linuxkit #1 SMP Mon Nov 8 10:21:19 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Package Version: 4.8.1
The text was updated successfully, but these errors were encountered:
Expected Behavior
When using
runMigration
as a library function from another piece of software the expected behaviour would be, that all exceptions raised during the execution of migrations to be thrown to the caller.Actual Behavior
We are calling
runMigration
from AWS Lambda functions in order to automate updates of our content models. The issue following issue occurs when an error during the execution of any migration occurs:runMigration
attempts to write an error log file.EROFS: read-only file system, open '/var/task/errors-2-1656322066050.log'
as the filesystem is mounted read-only for AWS Lambda handlers.writeErrorsToLog
promise is not caught, resulting inunhandledRejection
event to be raised.catch
blocks to be executed.Possible Solution
I'd suggest the following two adjustments:
writeErrorsToLog
.runMigration
is not used as a CLI (shouldThrow === true
).If someone agrees with these steps, I might be able to provide a PR myself.
Steps to Reproduce
Just execute run migrations from a read-only FS or mock
writeErrorsToLog
to fail.Context
Environment
AWS Lambda Container:
v14.19.2
6.14.17
Linux 56fa0daeae18 5.10.76-linuxkit #1 SMP Mon Nov 8 10:21:19 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
4.8.1
The text was updated successfully, but these errors were encountered: