0

I'm facing some issue in gulp task in azure devops build pipeline. The task is getting failed with the following error. Couldn't able to find where the actual error is. Please help to trace the error in gulp configuration. Thanks in advance

Error:

Error deploying { Error: read ECONNRESET
    at exports._errnoException (util.js:1026:11)
    at TLSWrap.onread (net.js:569:26) code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' }
Job's done!

Gulp Task:

gulp.task("upload:cdn", function () {
    var logger = console.log;
    var files = [];
    var opts = {
        serviceOptions: ['XXX', 'YYYY'], // custom arguments to azure.createBlobService 
        containerName: 'biz-core', // container name in blob 
        containerOptions: { publicAccessLevel: "blob" }, // container options 
        folder: 'assets', // path within container 
        deleteExistingBlobs: false, // true means recursively deleting anything under folder 
        concurrentUploadThreads: 2, // number of concurrent uploads, choose best for your network condition 
        zip: false, // gzip files if they become smaller after zipping, content-encoding header will change if file is zipped 
        metadata: { cacheControl: 'public,max-age=31536000' }, // metadata for each uploaded file 
        testRun: false // test run - means no blobs will be actually deleted or uploaded, see log messages for details 
    };
    deploy(opts, files, logger, function (err) {
        if (err) {
            console.log("Error deploying", err);
        }
        console.log('Job\'s done!');
    });
});
  • When you run the `gulp` command locally, how's the result? Try to set variable `system.debug` to `True` in the pipeline to see whether you can get more logs. – Cece Dong - MSFT Feb 08 '21 at 08:16

1 Answers1

0

"ECONNRESET" seems connection error. You could check gulp-deploy-azure-cdn plugin since you tried uploading files to Azure Blob Storage.

  npm install gulp-deploy-azure-cdn 

Using:

var deployCdn = require('gulp-deploy-azure-cdn');
var gulp = require('gulp');
var gutil = require('gulp-util');
 
gulp.task('upload-app-to-azure', function () {
    return gulp.src(['*.js','*.json'], {
        base: 'node_modules/deploy-azure-cdn' // optional, the base directory in which the file is located. The relative path of file to this directory is used as the destination path
    }).pipe(deployCdn({
        containerName: 'test', // container name in blob
        serviceOptions: ['blobstoragename', '/OwQ/MyLongSecretStringFromAzureConfigPanel'], // custom arguments to azure.createBlobService
        folder: '1.2.35-b27', // path within container
        zip: true, // gzip files if they become smaller after zipping, content-encoding header will change if file is zipped
        deleteExistingBlobs: true, // true means recursively deleting anything under folder
        concurrentUploadThreads: 10, // number of concurrent uploads, choose best for your network condition
        metadata: {
            cacheControl: 'public, max-age=31530000', // cache in browser
            cacheControlHeader: 'public, max-age=31530000' // cache in azure CDN. As this data does not change, we set it to 1 year
        },
        testRun: false // test run - means no blobs will be actually deleted or uploaded, see log messages for details
    })).on('error', gutil.log);
});
Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39