ember-cli-deploy-slack
ember-cli-deploy-slack copied to clipboard
Cannot convert object to primitive value when ember-cli-deploy-slack not installed but specified in deploy.js
Hello,
I had been ripping small amounts of hair out over the past few days trying to get lightning deploys working again for our teams. I finally realized that I had forgotten to install the Slack plugin. The fix was simple (ember install ember-cli-deploy-slack
) but the pain was real. Here's what this error looks like:
17:23 $ ember deploy:list stage
version: 1.13.15
Cannot convert object to primitive value
TypeError: Cannot convert object to primitive value
at String (native)
at Function.applyStyle (/Users/spetrow/projects/music_rights_ui/node_modules/ember-cli/node_modules/chalk/index.js:57:45)
at Chalk.builder (/Users/spetrow/projects/music_rights_ui/node_modules/ember-cli/node_modules/chalk/index.js:40:21)
at writeError (/Users/spetrow/projects/music_rights_ui/node_modules/ember-cli/lib/ui/write-error.js:19:24)
at UI.writeError (/Users/spetrow/projects/music_rights_ui/node_modules/ember-cli/lib/ui/index.js:92:3)
at Class.module.exports.Task.extend._configuredPlugins (/Users/spetrow/projects/music_rights_ui/node_modules/ember-cli-deploy/lib/tasks/pipeline.js:115:15)
at Class.module.exports.Task.extend.setup (/Users/spetrow/projects/music_rights_ui/node_modules/ember-cli-deploy/lib/tasks/pipeline.js:37:22)
at Class.module.exports.Task.extend.run (/Users/spetrow/projects/music_rights_ui/node_modules/ember-cli-deploy/lib/tasks/pipeline.js:87:10)
at /Users/spetrow/projects/music_rights_ui/node_modules/ember-cli-deploy/lib/commands/list.js:51:23
at lib$rsvp$$internal$$tryCatch (/Users/spetrow/projects/music_rights_ui/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1036:16)
at lib$rsvp$$internal$$invokeCallback (/Users/spetrow/projects/music_rights_ui/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1048:17)
at /Users/spetrow/projects/music_rights_ui/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:331:11
at lib$rsvp$asap$$flush (/Users/spetrow/projects/music_rights_ui/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1198:9)
at process._tickCallback (node.js:355:11)
The fix:
17:23 $ ember install ember-cli-deploy-slack
version: 1.13.15
Installed packages for tooling via npm.
Installed addon package.
✔ ~/projects/music_rights_ui [staging|✚ 2…1]
17:24 $ ember deploy:list stage
version: 1.13.15
- Listing revisions for key: `music-rights-ui-stage:index`
- revision
- ===========
- > 4837452
- c76ef39
Package.json:
Versions:
✔ ~/projects/music_rights_ui [staging|✚ 2…1]
17:24 $ node --version
v0.12.7
✔ ~/projects/music_rights_ui [staging|✚ 2…1]
17:30 $ ember --version
version: 1.13.15
node: 0.12.7
npm: 2.14.10
os: darwin x64
This also happened on our Jenkins CI which runs:
npm install
bower install
ember deploy ${EMBER_ENVIRON} --verbose --activate
Even on latest stable node (v5.7.1 (npm v3.6.0)
) it happens when using this deploy.js:
var VALID_DEPLOY_TARGETS = [ //update these to match what you call your deployment targets
'dev',
'test',
'stage',
'prod'
];
module.exports = function(deployTarget) {
var PROJECT_NAME = 'ember-cli-skeleton'; // TODO change me when settting up a new BOLT project
var ENV = {
build: {},
redis: {
// docs https://github.com/ember-cli-deploy/ember-cli-deploy-redis
host: '[REDACTED]',
allowOverwrite: true,
keyPrefix: PROJECT_NAME + ':index'
},
s3: {
accessKeyId: process.env.AWS_KEY,
secretAccessKey: process.env.AWS_SECRET,
bucket: '[REDACTED]',
region: 'us-west-2',
prefix: PROJECT_NAME
},
slack: {
webhookURL: "[REDACTED]'',
username: 'ember-cli-deploy via BOLT',
iconEmoji: ':zap:'
}
};
ENV["revision-data"] = {
//filePattern: '**/*.{html,js,css,png,gif,ico,jpg,map,xml,txt,svg,swf,eot,ttf,woff,woff2}',
type: 'git-commit'
};
if (VALID_DEPLOY_TARGETS.indexOf(deployTarget) === -1) {
throw new Error('Invalid deployTarget ' + deployTarget);
}
if (deployTarget === 'dev') {
ENV.build.environment = 'development';
ENV.redis.keyPrefix = PROJECT_NAME + '-dev:index';
ENV.s3.prefix = PROJECT_NAME + '-dev';
ENV.plugins = ['build', 'display-revisions', 'gzip', 's3', 'redis', 'revision-data', 'slack']; // everything except manifest since manifest breaks when asset versioning is d$
}
if (deployTarget === 'test') {
ENV.build.environment = 'test';
ENV.redis.keyPrefix = PROJECT_NAME + '-test:index';
ENV.s3.prefix = PROJECT_NAME + '-test';
ENV.plugins = ['build', 'display-revisions', 'gzip', 's3', 'redis', 'revision-data', 'slack']; // everything except manifest since manifest breaks when asset versioning is d$
}
if (deployTarget === 'stage') {
ENV.build.environment = 'staging';
ENV.redis.keyPrefix = PROJECT_NAME + '-stage:index';
ENV.s3.prefix = PROJECT_NAME + '-stage';
ENV.plugins = ['build', 'display-revisions', 'gzip', 's3', 'redis', 'revision-data', 'slack']; // everything except manifest since manifest breaks when asset versioning is d$
}
if (deployTarget === 'prod') {
ENV.build.environment = 'production';
ENV.redis.keyPrefix = PROJECT_NAME; // this is the same as we set in the config above (ENV.redis and ENV.s3), just here for clarity
ENV.s3.prefix = PROJECT_NAME;
}
return ENV;
};
...and this package.json
{
"name": "music-rights-ui",
"version": "0.0.0",
"description": "Small description for music-rights-ui goes here",
"private": true,
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"build": "ember build",
"start": "ember server",
"test": "ember test"
},
"repository": "",
"engines": {
"node": ">= 0.10.0"
},
"author": "",
"license": "MIT",
"devDependencies": {
"basscss": "^6.1.6",
"basscss-sass": "^1.0.2",
"broccoli-asset-rev": "^2.2.0",
"clone": "1.0.2",
"ember-cli": "^1.13.15",
"ember-cli-accounting": "1.0.0",
"ember-cli-app-version": "^1.0.0",
"ember-cli-babel": "^5.1.5",
"ember-cli-bootstrap-sassy": "0.5.1",
"ember-cli-coffeescript": "0.11.0",
"ember-cli-content-security-policy": "0.4.0",
"ember-cli-datepicker": "2.0.1",
"ember-cli-dependency-checker": "^1.1.0",
"ember-cli-deploy": "0.6.0",
"ember-cli-deploy-lightning-pack": "0.5.0",
"ember-cli-emblem": "0.3.1",
"ember-cli-htmlbars": "^1.0.1",
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-ic-ajax": "0.2.1",
"ember-cli-inject-live-reload": "^1.3.1",
"ember-cli-moment-shim": "0.6.2",
"ember-cli-pure": "1.0.1",
"ember-cli-qunit": "^1.0.4",
"ember-cli-release": "0.2.8",
"ember-cli-sass": "^4.0.1",
"ember-cli-selectize": "0.4.2",
"ember-cli-sri": "^1.1.0",
"ember-cli-uglify": "^1.2.0",
"ember-data": "1.13.15",
"ember-disable-proxy-controllers": "^1.0.1",
"ember-export-application-global": "^1.0.4",
"ember-faker": "1.1.0",
"ember-i18n": "4.2.0",
"ember-moment": "4.1.0",
"ember-pikaday": "0.10.0",
"ember-power-select": "0.8.4",
"ember-simple-auth": "1.0.1",
"handlebars-intl": "^1.1.1",
"torii": "^0.6.1"
},
"dependencies": {
"ember-radio-buttons": "^4.0.1"
}
}
( note that ember-cli-deploy-slack
is missing)
If nothing else, how can we make this error more useful (e.g. Missing Ember CLI Deploy plugin: slack
) ? My apologies in advance if this should be opened against ember-cli-deploy directly instead.
Thanks!
This sounds like something we need handle in ember-cli-deploy directly. I'll look into that thx!
@LevelbossMike Yup-- would be great to handle this in ember-cli-deploy
. I just ran into this same issue: "Cannot convert object to primitive value", but with a different plugin.
I appear to be getting this too; I've now installed the slack plugin but still getting this message? What's the best way to work around this?
This happens for any addon that you have configured and that is not installed. Are you missing another configured plugin @ksnyde?