简体   繁体   English

Heroku 版本上的“=?= 未知错误”表示什么?

[英]What does "=!= Unknown error" indicate on Heroku build?

I have a Django application running on Heroku with a web dyno on a container stack.我有一个web应用程序在 Heroku 上运行,web 测功机在container堆栈上。 On adding a worker dyno via my app.json and heroku.yml files, Heroku's build system for my Review app logs:通过我的 app.json 和 heroku.yml 文件添加worker测功机,Heroku 为我的 Review 应用程序日志构建系统:

=== Fetching app code
=!= Unknown error

The application builds properly locally via Docker and via Docker Compose.该应用程序通过 Docker 和 Docker Compose 在本地正确构建。 It has been building properly on Heroku until I modified my heroku.yml file and app.json file to add a worker.它一直在 Heroku 上正确构建,直到我修改了heroku.yml文件和app.json文件以添加工人。

My questions are:我的问题是:

  • What does "=?= Unknown error" signify, What part of Heroku's stack is throwing it? "=?= Unknown error" 表示什么,Heroku 堆栈的哪一部分正在抛出它? and what part of my configuration is likely causing it?我的配置的哪一部分可能导致它?
  • How can I debug this problem?我该如何调试这个问题?

Relevant files:相关文件:

heroku.yml: heroku.yml:

build:
  docker:
    web: Dockerfile
release:
  command:
    - ./release_commands.sh
  image: web
run:
  web:
    command: newrelic-admin run-program python manage.py runserver 0.0.0.0:$PORT
  worker:
    command: newrelic-admin run-program python manage.py rqworker app
    image: web

app.json: app.json:

{
  "name": "my-app",
  "stack": "container",
  "formation": {
    "web": {
      "quantity": 1
    },
    "worker": {
      "quantity": 1
    }
  },
  "environments": {
    "review": {
      "formation": {
        "web": {
          "quantity": 1,
          "size": "hobby"
        },
        "worker": {
          "quantity": 1,
          "size": "hobby"
        }
      },
      "addons": [
        "heroku-redis",
        {
          "plan": "heroku-postgresql",
          "options": {
            "version": 13
          }
        }
      ],
      "env": {
        "DEBUG": 1,
        "ENVIRONMENT": "dev",
        "ALLOWED_HOST": ".herokuapp.com",
        "CSRF_TRUSTED_DOMAIN": "*.herokuapp.com"
      }
    }
  }
}

For the next person to encounter this problem: this was corner case between two heroku.yml issues, caused by YAML ordering.对于下一个遇到此问题的人:这是两个heroku.yml问题之间的极端案例,由 YAML 订购引起。

  1. Heroku expects the run.<app>.command to be an array. Heroku 期望run.<app>.command是一个数组。 If it isn't, Heroku will throw a parsing error (below).如果不是,Heroku 将抛出解析错误(如下)。
  2. Heroku expects run to be defined above release . Heroku 期望runrelease上面定义。 If it isn't, and condition (1) is present, Heroku will fail to throw a parsing error and instead throw Unknown error .如果不是,并且条件 (1) 存在, Heroku 将无法抛出解析错误,而是抛出Unknown error

Here is the error the user would see if the above heroku.yml were modified:如果上述heroku.yml被修改,用户将看到以下错误:

Properly ordered heroku.yml with command improperly set as a string instead of an array:正确订购heroku.ymlcommand不正确地设置为字符串而不是数组:

build:
  docker:
    web: Dockerfile
run:
  web:
    command: newrelic-admin run-program python manage.py runserver 0.0.0.0:$PORT
  worker:
    command: newrelic-admin run-program python manage.py rqworker app
    image: web
release:
  command:
    - ./release_commands.sh
  image: web

Yields the build error:产生构建错误:

=== Fetching app code
=!= There were problems parsing your heroku.yml. We've detected the following issues:
run.worker.command needs to be in array format, such as:
run:
  worker:
    command:
      - newrelic-admin run-program python manage.py rqworker app heap braze
    image: web

Order shouldn't matter to YAML keys ( https://yaml.org/spec/1.2.2/#3221-mapping-key-order ).顺序对 YAML 键( https://yaml.org/spec/1.2.2/#3221-mapping-key-order )无关紧要。 But when run is defined below release , and no other changes are made, Heroku's error output looks like this:但是当run定义在release下面,并且没有进行其他更改时,Heroku 的错误 output 看起来像这样:

=== Fetching app code
=!= Unknown error

So, one cause of this Heroku error output is YAML ordering.因此,此 Heroku 错误 output 的一个原因是 YAML 订购。 Switching keys around fixes the problem.左右切换键可以解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM