gulp-gcloud-publish
gulp-gcloud-publish copied to clipboard
[22:53:56] TypeError: file.pipe is not a function
Uploading CSS/JS to GCP is simply not working and throwing this strange error. TypeError: file.pipe is not a function
Here are my gulp dependencies that I am loading:
const autoprefixer = require("autoprefixer"); // v 9.5.1
const cssnano = require("cssnano"); // v 4.1.10
const { src, dest, watch, series, parallel } = require("gulp"); // v 4.0.1
const postcss = require("gulp-postcss"); // v 8.0.0"
const sass = require("gulp-sass"); // v 4.0.2
const uglify = require('gulp-uglify'); // v 3.0.2
const jshint = require('gulp-jshint'); // v 2.1.0
var gcPub = require('gulp-gcloud-publish'); // v 2.1.1
//var gzip = require('gulp-gzip'); // v 1.4.2
var log = require('fancy-log'); // v 1.3.3
Here are my file paths for my SCSS and JS files:
const files = {
scssPath: './src/scss/**/*.scss',
jsPath: 'src/js/**/*.js'
}
Here is my deploy task I have for compiling my SASS and uploading the compiled CSS file to my GCP bucket (I am passing the SCSS file path to the gulp src function):
function scssTaskGCP() {
return src(files.scssPath)
.pipe(sass())
.pipe(postcss([ autoprefixer(), cssnano()]))
.pipe(gcPub(
{
bucket: 'bucket-name',
keyFilename: process.env.GCP_KEY_FILE,
projectId: process.env.GCP_PROJECT_ID,
base: '/assets/css',
public: true,
resumable: true,
transformDestination: function(path) {
return path.toLowerCase();
},
metadata: {
cacheControl: 'max-age=315360000, no-transform, public',
}
}
));
}
When the scssTaskGCP() task is run via my CI/CD pipeline, I receive this error message:
+ gulp deploy
[22:32:36] Using gulpfile /opt/atlassian/pipelines/agent/project-folder/hca-craft/gulpfile.js
[22:32:36] Starting 'deploy'...
[22:32:36] Starting 'scssTaskGCP'...
[22:32:37] 'scssTaskGCP' errored after 846 ms
**[22:32:37] TypeError: file.pipe is not a function**
**at DestroyableTransform._transform (/opt/atlassian/pipelines/agent/build/project-folder/node_modules/gulp-gcloud-publish/libs/index.js:113:10)**
...
[22:32:37] 'deploy' errored after 848 ms
I have been pulling my hair out trying to figure out what I'm doing wrong, and figured it could be a gulp 4 incompatibility issue. May you please be able to assist/investigate? Thanks!
Update: I had to downgrade to Gulp 3.9.1 in order for my deployment to work. This package seems to be outdated and incompatible with Gulp 4+. Just FYI! :)
Yeah, I haven't used Gulp in a log time now.
Help to bring this project up-to-date with the latest Gulp version is welcome