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
{{ message }}
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
Hi team, thanks so much for this adapter I've had a lot of success with it except for one issue. I'm having trouble catching an error triggered by the receiver.write function. When an error occurs it completely stops my Sails app. I've tried wrapping the method in try/catch blocks and setting up promises but I can't figure it out.
My code is:
const adapter = require('skipper-better-s3')(sails.config.uploads.s3);
const receiver = adapter.receive(receiverParams);
receiver.write(localFile, (err) => {
if (err) {
sails.log.error('Error uploading to Amazon S3:', err);
} else if ( localFile.extra && localFile.extra.key ) {
sails.log.info('Uploaded file to Amazon S3: ' + localFile.extra.key);
}
});
You can reliably get an error firing by setting the s3 region to a random string.
I did have a similar problem with the adapter.read function causing my app to crash if there was no matching key on S3 matching the file descriptor, however I was able to resolve this by stringing on an "on('error')" function. However this doesn't work to resolve the issue I'm having with receiver.write :(
Hi team, thanks so much for this adapter I've had a lot of success with it except for one issue. I'm having trouble catching an error triggered by the receiver.write function. When an error occurs it completely stops my Sails app. I've tried wrapping the method in try/catch blocks and setting up promises but I can't figure it out.
My code is:
You can reliably get an error firing by setting the s3 region to a random string.
I did have a similar problem with the adapter.read function causing my app to crash if there was no matching key on S3 matching the file descriptor, however I was able to resolve this by stringing on an "on('error')" function. However this doesn't work to resolve the issue I'm having with receiver.write :(
I'm a bit of a beginner so it's probably really obvious what I'm doing wrong. Is anyone able to help?
Thanks so much,
Madison
The text was updated successfully, but these errors were encountered: