-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Description
Without async/await, publishing to s3 results in
Starting 'publishTechnicalDocumentationInternalS3'...
The following tasks did not complete: publishTechnicalDocumentationInternalS3
Did you forget to signal async completion?
When declaring it as async, and awaiting it, the compiler returns success in 13ms, but no resulting files on s3 can be found.
export const publishS3 = async function (module, version) {
// create a new publisher using S3 options
// http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#constructor-property
const publisher = awspublish.create(
{
signatureVersion: 'v4',
accessKeyId: '<MyKeyId>',
secretAccessKey: '<MyKeySecret>',
params: {
Bucket: '<MyBucket>',
},
},
{
cacheFileName: 'cache',
},
);
// define custom headers
const headers = {
'Cache-Control': 'max-age=315360000, no-transform, public',
'x-amz-acl': 'public-read',
};
let prefix = '<MyPrefix>';
if (prefix) {
prefix += '/';
}
return gulp
.src(`./build/site/${module.toLowerCase()}/${version}/**`)
.pipe(
rename(function (path) {
path.dirname = `${module.toLowerCase()}/${prefix}${path.dirname}`;
}),
)
.pipe(parallelize(publisher.publish(headers), 10))
.pipe(publisher.sync(`${module.toLowerCase()}/${prefix}`))
.pipe(publisher.cache())
.pipe(awspublish.reporter());
};
export const publishTechnicalDocumentationInternalS3 = async () => await publishS3('Technical-Documentation', 'internal');
So, the outcome is:
Using gulpfile ~/Documents/Limecraft/technical-documentation/gulpfile.js
Starting 'publishTechnicalDocumentationInternalS3'...
Finished 'publishTechnicalDocumentationInternalS3' after 11 ms
I guess it's the issue with streams and promises, and although I tried a couple of approaches (generating a Promise on my own, using stream-to-promise library), none of them seem to be working.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels