forwardemail / forwardemail/superagent
superagent.get doesn't behave as readable stream with AWS.S3.upload
- Dominant language
- JavaScript
- Stars
- 16.6k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I'm trying to use `superagent.get` with `S3.upload`, but it appears `.get` doesn't return readable stream, so upload never starts.
```
const request = require('superagent');
const AWS = require('aws-sdk');
const S3 = new AWS.S3({ ... });
const stream = request.get(nonExistentUrl);
S3.upload({ Bucket: 'my-bucket', Key: 'file.txt', Body: stream}, (...args) => {
console.log(...args);
});
```
I am trying to test with faulty URL that returns `404`, and I expect upload to fail.
But it appears upload is never started unless I call `stream.end()`, then 404 error is printed to console.
This behavior is consistent in v3 and v4.
Contributor guide
Assessment
This issue has not been assessed yet.