我有一个运行在aws弹性beanstalk上的服务器。它一切都很好。但今天在应用更新时(绝对与所使用的模块的配置或版本无关),这只是在网络应用程序中的某些文本中添加了几个单词(字面意思是“狗”#39;)。应用程序因502 nginx网关错误而崩溃。我认为这是因为该应用程序不是在冒充。我去了并改变了改变(虽然我不认为我必须这样做)。问题仍然存在。
尝试提升/启动风帆应用程序时的输出如下:
Failed to load helper `web/auth/validate-user-password` as a machine!
A hook (`helpers`) failed to load!
Failed to lift app: ImplementationError: Sorry, could not interpret "web/auth/validate-user-password" because its underlying implementation has a problem:
------------------------------------------------------
• The `cacheable` property is no longer supported. (Please use `sideEffects: 'cacheable' instead.)
------------------------------------------------------
If you are the maintainer of "web/auth/validate-user-password", then you can change its implementation to solve the problem above. Otherwise, please file a bug report with the maintainer, or fork your own copy and fix that.
[?] See https://sailsjs.com/support for help.
at flaverr (/var/app/current/node_modules/flaverr/index.js:77:15)
at helpBuildMachine (/var/app/current/node_modules/sails/node_modules/machine/lib/private/help-build-machine.js:127:11)
at Function.build (/var/app/current/node_modules/sails/node_modules/machine/lib/build.js:52:10)
at /var/app/current/node_modules/sails/lib/hooks/helpers/load-helpers.js:51:49
at /var/app/current/node_modules/@sailshq/lodash/lib/index.js:3228:15
at baseForOwn (/var/app/current/node_modules/@sailshq/lodash/lib/index.js:2199:14)
at /var/app/current/node_modules/@sailshq/lodash/lib/index.js:3198:18
at Function.<anonymous> (/var/app/current/node_modules/@sailshq/lodash/lib/index.js:3501:13)
at /var/app/current/node_modules/sails/lib/hooks/helpers/load-helpers.js:37:9
at helpBuildDictionary (/var/app/current/node_modules/sails/node_modules/include-all/lib/help-build-dictionary.js:135:10)
at Function.module.exports.optional (/var/app/current/node_modules/sails/node_modules/include-all/index.js:67:10)
at Hook.loadHelpers (/var/app/current/node_modules/sails/lib/hooks/helpers/load-helpers.js:21:14)
at Hook.initialize (/var/app/current/node_modules/sails/lib/hooks/helpers/index.js:28:19)
at Hook.wrapper [as initialize] (/var/app/current/node_modules/@sailshq/lodash/lib/index.js:3250:19)
at /var/app/current/node_modules/sails/lib/hooks/index.js:88:16
at /var/app/current/node_modules/async/dist/async.js:486:20
(You are seeing the above error message because no custom callback was programmatically provided to `.lift()`.)
A hook (`orm`) failed to load!
这是我在package.json中看到的,以防它有用。
{
"name": "sails-xxxxxxx-seed",
"private": true,
"version": "0.0.3-147",
"description": "a Sails application",
"keywords": [],
"dependencies": {
"async": "2.0.1",
"aws-sdk": "^2.41.0",
"bcryptjs": "2.3.0",
"connect-redis": "3.3.0",
"flaverr": "^1.1.1",
"lodash": "3.10.1",
"machinepack-http": "3.1.2",
"moment-timezone": "0.5.13",
"pdfmake": "0.1.28",
"sails": "^1.0.0-32",
"sails-hook-orm": "^2.0.0-0",
"sails-hook-sockets": "^1.0.1",
"sails-mysql": "^1.0.0-13",
"sails-stdlib": "^0.7.1",
"sails.io.js": "1.1.9",
"serve-static": "1.12.3",
"socket.io-client": "1.7.3",
"socket.io-redis": "3.1.0",
"uuid": "3.0.1"
},
"devDependencies": {
"@angular/animations": "~4.1.3",
"@angular/common": "~4.1.3",
"@angular/compiler": "~4.1.3",
"@angular/compiler-cli": "~4.1.3",
"@angular/core": "~4.1.3",
"@angular/forms": "~4.1.3",
"@angular/http": "~4.1.3",
"@angular/platform-browser": "~4.1.3",
"@angular/platform-browser-dynamic": "~4.1.3",
"@angular/platform-server": "~4.1.3",
"@angular/router": "~4.1.3",
"@angular/upgrade": "~4.1.3",
"@swimlane/ngx-datatable": "^8.0.0",
"@types/jasmine": "^2.5.47",
"@types/node": "^6.0.48",
"angular-pipes": "^6.5.1",
"angular-router-loader": "^0.6.0",
"angular2-in-memory-web-api": "0.0.21",
"angular2-moment": "^1.3.3",
"angular2-template-loader": "^0.6.0",
"angular2-text-mask": "^8.0.1",
"awesome-typescript-loader": "^3.1.2",
"babel-core": "^6.25.0",
"babel-loader": "^7.0.0",
"babel-preset-env": "^1.5.2",
"babel-preset-es2015": "^6.24.1",
"chart.js": "^2.5.0",
"clean-webpack-plugin": "0.1.16",
"clipboard": "^1.6.1",
"copy-webpack-plugin": "4.0.1",
"core-js": "^2.4.1",
"css-loader": "0.27.3",
"debug": "^2.6.8",
"ejs-loader": "0.3.0",
"eslint": "3.19.0",
"extract-text-webpack-plugin": "2.1.0",
"file-loader": "^0.11.1",
"glob": "^7.1.1",
"ie-shim": "^0.1.0",
"json2csv": "^3.7.3",
"knex": "0.13.0",
"less": "2.7.2",
"less-loader": "4.0.1",
"mime-types": "2.1.15",
"mocha": "^3.2.0",
"mydatepicker": "^1.9.2",
"ng-sidebar": "^4.1.1",
"ng2-charts": "^1.5.0",
"ng2-table": "^1.3.2",
"ng2-toastr": "^4.0.1",
"ng2-validation": "^4.1.0",
"ngx-bootstrap": "^1.6.6",
"ngx-progressbar": "^2.0.0",
"node-sass": "^4.5.2",
"primeng": "^4.0.0",
"prompt": "1.0.0",
"raw-loader": "^0.5.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"sass-loader": "^6.0.3",
"semver": "^5.3.0",
"to-string-loader": "^1.1.4",
"typescript": "~2.2.1",
"url-loader": "^0.5.8",
"waterline-utils": "^1.3.12",
"webpack": "^2.2.1",
"webpack-livereload-plugin": "^0.11.0",
"webpack-merge": "^0.15.0",
"webpack-watch-livereload-plugin": "0.0.1",
"zone.js": "~0.6.26"
},
"scripts": {
"start": "NODE_ENV=production node app.js",
"test": "npm run lint && npm run custom-tests && echo 'Done.'",
"lint": "node ./node_modules/eslint/bin/eslint . --max-warnings=0 && echo '✔ Your code looks good.'",
"custom-tests": "echo \"(No other custom tests yet.)\" && echo",
"version": "node -e 'process.stdout.write((require(\"./package.json\").version))'",
"bump": "node scripts/bump.js",
"debug": "node debug app.js",
"deploy-staging": "sails_environment=web_staging npm run bump && sails_environment=web_staging npm run deploy",
"deploy-demo": "sails_environment=web_demo npm run bump && npm run deploy",
"deploy": "cp -r eb/bootstrap/$sails_environment.sh .ebbootstrap.sh && npm run zip && rm .ebbootstrap.sh && node scripts/publish-static-assets && node scripts/deploy-to-eb",
"zip": "mkdir -p .tmp && rm .tmp/deploy.zip &> /dev/null; zip -9 -r --exclude=node_modules/* --exclude=.tmp/* --exclude=.DS_Store --exclude=.git/* --exclude=config/local.js ./.tmp/deploy.zip .",
"deploy-alerts-staging": "sails_environment=alerts_staging npm run bump && sails_environment=alerts_staging npm run deploy-alerts",
"deploy-alerts": "cp eb/bootstrap/$sails_environment.sh .ebbootstrap.sh && cp eb/apps/alerts/cron.yaml cron.yaml && npm run zip-backend && rm cron.yaml .ebbootstrap.sh && node scripts/deploy-to-eb",
"deploy-rollup-staging": "sails_environment=rollup_staging npm run bump && sails_environment=rollup_staging npm run deploy-rollup",
"deploy-rollup": "cp eb/bootstrap/$sails_environment.sh .ebbootstrap.sh && cp eb/apps/rollup/cron.yaml cron.yaml && npm run zip-backend && rm cron.yaml .ebbootstrap.sh && node scripts/deploy-to-eb",
"deploy-devices-staging": "sails_environment=devices_staging npm run bump && sails_environment=devices_staging npm run deploy-devices",
"deploy-devices": "cp eb/bootstrap/$sails_environment.sh .ebbootstrap.sh && npm run zip-backend && rm .ebbootstrap.sh && node scripts/deploy-to-eb",
"deploy-device-sim": "cp eb/bootstrap/device_sim.sh .ebbootstrap.sh && cp eb/apps/device-sim/cron.yaml cron.yaml && npm run zip-backend && rm cron.yaml .ebbootstrap.sh && sails_environment=device_sim npm run bump && sails_environment=device_sim node scripts/deploy-to-eb",
"zip-backend": "mkdir -p .tmp && rm .tmp/deploy.zip &> /dev/null; zip -9 -r --exclude=node_modules/* --exclude=.tmp/* --exclude=.DS_Store --exclude=.git/* --exclude=src/* --exclude=config/local.js ./.tmp/deploy.zip ."
},
"main": "app.js",
"repository": {
"type": "git",
"url": "xxxxxxxxxx.git"
},
"author": "xxxxxx",
"license": ""
}
及以下是validate-user-password.js
module.exports = {
friendlyName: 'Validate user password (strict)',
description: 'Strictly validate a string as the potential "password" for a user.',
cacheable: true,
sync: true,
inputs: {
string: {
description: 'The string to validate as a password.',
required: true,
example: 'abcd1234',
}
},
exits: {
success: {
description: 'The specified string is 100% valid.'
},
notValid: {
description: 'The specified string is not a valid password.'
},
},
fn: function (inputs,exits) {
// Coerce
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Since we don't need to support `strict: false` for this validator (it is ALWAYS strict), then we can
// just skip this part. (Also no need for the "notStrictlyValid" exit, output from the success exit,
// or the `strict` input)
//
// n/a
// Validate
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// • Must be long enough.
if (inputs.string.length < 7) {
return exits.notValid(new Error('Password must consist of at least 7 characters.'));
}
// • Must not be too long.
if (inputs.string.length > 72) {
return exits.notValid(new Error('Password must not contain more than 72 characters.'));
}
return exits.success();
}
};
答案 0 :(得分:0)
实际上,它可能是Sails本身的更新导致的。您是否为validate-user-password.js
尝试了以下配置?
module.exports = {
friendlyName: 'Validate user password (strict)',
description: 'Strictly validate a string as the potential "password" for a user.',
sideEffects: 'cacheable',
sync: true,
/* ... rest of content ... */
}
答案 1 :(得分:0)
我想知道问题是否与Sails核心使用的data () {
return {
items: []
}
},
版本中的这次更改有关。除非手动增加了Sails依赖项的语义版本范围(SVR),否则这通常不会影响您的应用程序。但是由于此应用使用的是Sails v1的预发布版本,因此很可能是此更改在下游获得的原因。
如@Alexis N-o所述,解决方案是使用以下方法代替使用machine
:
cacheable: true