Conversation
src/providers/aws.js
Outdated
| } catch (e) { | ||
| this._logger.warn('failed to load aws-sdk/clients/s3', e); | ||
| } |
There was a problem hiding this comment.
| } catch (e) { | |
| this._logger.warn('failed to load aws-sdk/clients/s3', e); | |
| } | |
| } catch (err) { | |
| this._logger.warn({ err }, 'failed to load aws-sdk/clients/s3'); | |
| } |
otherwise error will not get serialized - this is an optimization in the logger
src/providers/aws.js
Outdated
| connect() { | ||
| return Promise | ||
| .bind(this) | ||
| .then(this.findOrCreateBucket); | ||
| } |
There was a problem hiding this comment.
we can use native promises now:
| connect() { | |
| return Promise | |
| .bind(this) | |
| .then(this.findOrCreateBucket); | |
| } | |
| async connect() { | |
| return this.findOrCreateBucket(); | |
| } |
| const params = { | ||
| Bucket: this._config.bucketName, | ||
| Expires: action === 'putObject' ? UPLOAD_URL_EXPIRES_IN_SEC : DOWNLOAD_URL_EXPIRES_IN_SEC, | ||
| Key: input.key, | ||
| }; |
There was a problem hiding this comment.
not familiar with s3 signed URLs, but on google you have to sign headers as well, especially for put action.
headers include object size, any custom headers, etc - could this be required here?
src/providers/aws.js
Outdated
| } | ||
|
|
||
| connect() { | ||
| return Promise |
There was a problem hiding this comment.
Promise.bind is specific to bluebird (http://bluebirdjs.com/docs/getting-started.html)
| return provider; | ||
| } | ||
|
|
||
| // eslint-disable-next-line class-methods-use-this |
There was a problem hiding this comment.
can use static modifier since we are not using this
test/suites/providers/aws.js
Outdated
| accessKeyId: 'AKIASS5V3WV23VA4KYOF', | ||
| accessKeySecret: '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', |
There was a problem hiding this comment.
these keys must be revoked now as they were commited to open source code - they must be passed on via .env and never be commited
773348a to
348f597
Compare
Codecov Report
@@ Coverage Diff @@
## master #227 +/- ##
==========================================
- Coverage 92.78% 92.50% -0.29%
==========================================
Files 49 49
Lines 1289 1294 +5
==========================================
+ Hits 1196 1197 +1
- Misses 93 97 +4
Continue to review full report at Codecov.
|
348f597 to
99a1a80
Compare
09e6621 to
77cc20c
Compare
77cc20c to
2414957
Compare
| async subscribe() { | ||
| const { Topics: topics } = await new SNS({ region: this._config.aws.credentials.region }).listTopics({}).promise(); | ||
|
|
||
| const topicArn = `arn:aws:sns:us-west-2:178085672309:${this._config.aws.credentials.topicName}`; |
|
|
||
| async function handleListBuckets(err, data) { | ||
| if (err) { | ||
| this.log.warn('s3 bucket can not be created'); |
There was a problem hiding this comment.
| this.log.warn('s3 bucket can not be created'); | |
| this.log.warn({ err }, 's3 bucket can not be created'); |
| await aws.createBucket(bucketParams, function handleCreateBucket(_err) { | ||
| if (_err) { | ||
| this.log.warn('s3 bucket can not be created'); | ||
| } | ||
| }); |
| }; | ||
|
|
||
| return new Promise((resolve, reject) => { | ||
| this._aws.getSignedUrl('putObject', params, (err, url) => { |
| // }, | ||
| // ]; | ||
|
|
||
| exports.transport = env.PROVIDER === 'aws' ? awsTransport : awsTransport; |
| return this.files | ||
| .postProcess(0, Date.now()) | ||
| .reflect() | ||
| .then(inspectPromise()); |
There was a problem hiding this comment.
this is a legacy implementstion, its best to use the following now:
| return this.files | |
| .postProcess(0, Date.now()) | |
| .reflect() | |
| .then(inspectPromise()); | |
| await this.files.postProcess(0, Date.now()) |
| it('rejects to show direct only file without proper username', function test() { | ||
| return downloadFile | ||
| .call(this, { uploadId: this.response.uploadId }) | ||
| .reflect() | ||
| .then(inspectPromise(false)); | ||
| }); |
There was a problem hiding this comment.
for these things its best to do this:
| it('rejects to show direct only file without proper username', function test() { | |
| return downloadFile | |
| .call(this, { uploadId: this.response.uploadId }) | |
| .reflect() | |
| .then(inspectPromise(false)); | |
| }); | |
| it('rejects to show direct only file without proper username', async function test() { | |
| await assert.rejects(downloadFile.call(this, { uploadId: this.response.uploadId })); | |
| }); |
No description provided.