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

getObject can throw uncaught ENOENT if object is concurrently deleted #71

Open
gabegorelick opened this issue Jul 31, 2020 · 0 comments

Comments

@gabegorelick
Copy link
Contributor

Relevant code from getObject:

mock-aws-s3/lib/mock.js

Lines 312 to 314 in 6b5aa02

fs.readFile(path, function (err, data) {
if (!err) {
var stat = fs.statSync(path)

Ignoring the fact that this probably shouldn't be doing synchronous I/O (if not, then why isn't readFileSync being called instead of the async variant?), the issue is the underlying file may be deleted in between the readFile and statSync calls. This results in an uncaught Error: ENOENT: no such file or directory, instead of the expected NoSuchKey error being returned.

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

No branches or pull requests

1 participant