部署到 AWS Elastic Beanstalk 失败,出现异常“UTF-8 中的字节序列无效”
Posted
技术标签:
【中文标题】部署到 AWS Elastic Beanstalk 失败,出现异常“UTF-8 中的字节序列无效”【英文标题】:Deployment to AWS Elastic Beanstalk failing with exception "invalid byte sequence in UTF-8" 【发布时间】:2018-07-09 16:38:26 【问题描述】:我在 64 位 Amazon Linux 发行版上的 Elastic Beanstalk 上运行我的应用程序。
代理服务器为 nginx & Node 版本 6.11.1
在过去的几个月里,部署一直是轻而易举的事,但从昨晚开始就开始失败。没有对 beanstalk 配置进行任何更改。
来自 eb-activity.log 的日志跟踪
[2018-01-30T17:35:10.892Z] INFO [3620] - [Application update
app-a958-180130_183239@128/AppDeployStage0/AppDeployPreHook/50npm.sh]
: **Activity has unexpected exception, because: invalid byte sequence in
UTF-8 (ArgumentError) at**
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:272:in `gsub' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:272:in `format_result' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:151:in `timeout_exec' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:123:in `block in create' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:122:in `instance_eval' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:122:in `create' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/hook-directory-executor.rb:29:in
`block in run!' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/hook-directory-executor.rb:27:in
`each' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/hook-directory-executor.rb:27:in
`run!' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/command.rb:211:in
`block (3 levels) in exec_stage' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:195:in `call' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:195:in `exec' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:140:in `timeout_exec' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:123:in `block in create' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:122:in `instance_eval' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:122:in `create' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/command.rb:206:in
`block (2 levels) in exec_stage' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/command.rb:204:in
`each' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/command.rb:204:in
`each_with_index' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/command.rb:204:in
`block in exec_stage' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:195:in `call' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:195:in `exec' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:140:in `timeout_exec' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:123:in `block in create' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:122:in `instance_eval' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:122:in `create' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/command.rb:201:in
`exec_stage' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/command.rb:148:in
`execute!' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/command-processor.rb:77:in
`block (3 levels) in execute!' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:195:in `call' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:195:in `exec' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:140:in `timeout_exec' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:123:in `block in create' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:122:in `instance_eval' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/activity.rb:122:in `create' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/command-processor.rb:74:in
`block (2 levels) in execute!' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/command-processor.rb:144:in
`execute_command' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/command-processor.rb:70:in
`block in execute!' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/healthd_reporter.rb:50:in
`log' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/lib/elasticbeanstalk/command-processor.rb:69:in
`execute!' from
/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.2.0/gems/beanstalk-core-2.10/bin/command-processor:45:in
`<top (required)>' from
/opt/elasticbeanstalk/lib/ruby/bin/command-processor:23:in `load'
from /opt/elasticbeanstalk/lib/ruby/bin/command-processor:23:in
`<main>'
【问题讨论】:
我在 eb 活动日志中遇到了同样的问题。 【参考方案1】:此处发布的根本原因和解决方法 - https://commscentral.net/tech/?post=65
【讨论】:
有这方面的消息吗? 或者你还记得如何访问 ebnode.py 吗?是通过 EB CLI 吗? 是通过 CLI。文件路径 - /opt/elasticbeanstalk/containerfiles/ebnode.py以上是关于部署到 AWS Elastic Beanstalk 失败,出现异常“UTF-8 中的字节序列无效”的主要内容,如果未能解决你的问题,请参考以下文章
使用 AWS CodeBuild 和 EB CLI 部署到 AWS Elastic Beanstalk
部署到 AWS Elastic Beanstalk 时的 ConnectionString 转换
如何使用TFS 2017部署到Elastic Beanstalk?