Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/do not write errors to file when used as library #1113

Conversation

simOneAudi
Copy link

Summary

We are using this package to migrate our content models. Whenever a runtime error occurs in one of our backends based on Lambda functions, the whole handler errors out because of an unhandled promise rejection caused by the Lambda's filesystem being mounted as readonly and thus not allowing the error files to be written.

Description

In order to fix this issue, the PR adjusts two things:

  • Error files will not be written in case the function is used as a library/imported from another location (shouldThrow === true).
  • The writing of error files will be awaited so that any possible exception raised will not result in an unhandled promise rejection.

Motivation and Context

When used as a library, the error files are probably irrelevant, except for debugging purposes, or might - as in our case - even be harmful, as depending on the runtime environment, no filesystem is available.

Todos

This is rather a proposal than an actual finished implementation, as I do not have the time and knowledge, to build and verify the changes.

  • Provide proposal
  • Verify implementation
  • Add/adjust tests

Merge in OSSC/contentful-migration from fix/prevent-unhandled-promise-rejections to master

* commit '167326b4f3b7657aba433c9536155b489a239998':
  fix: skip writing of error logs for library usage
@ruderngespra
Copy link
Contributor

Hey, hey, sorry you are running into this, and thanks for the proposal! I think this makes a lot of sense.

I will discuss it internally and let you know once there is more to share regarding whether or not and when this will be implemented! Will close this PR for the time being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants