微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

我的渡槽应用程序无法绑定到heroku上的给定端口

如何解决我的渡槽应用程序无法绑定到heroku上的给定端口

我遵循了有关如何在Heroku(即https://aqueduct.io/docs/deploy/deploy_heroku/)上部署Aqueduct应用程序的官方教程。我能够成功连接到Postgresql数据库并使用发行版dyno推动初始迁移,但是当我尝试使用网络dyno运行应用程序时,出现以下错误

2020-09-12T08:37:48.024346+00:00 app[web.1]: -- Preparing...
2020-09-12T08:38:13.885510+00:00 app[web.1]: -- Starting application 'easyprintbot/easyprintbot'
2020-09-12T08:38:13.891105+00:00 app[web.1]:     Channel: EasyprintbotChannel
2020-09-12T08:38:13.891309+00:00 app[web.1]:     Config: /app/heroku.yaml   
2020-09-12T08:38:13.896358+00:00 app[web.1]:     Port: 50277
2020-09-12T08:38:50.094519+00:00 app[web.1]: [INFO] aqueduct: Server aqueduct/1 started.
2020-09-12T08:40:43.299225+00:00 heroku[web.1]: Error R10 (Boot timeout) -> 
Web process Failed to bind to $PORT within 180 seconds of launch
2020-09-12T08:40:43.321337+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-09-12T08:40:43.660088+00:00 heroku[web.1]: Process exited with status 137
2020-09-12T08:40:43.754862+00:00 heroku[web.1]: State changed from starting 
to crashed

我什至试图将启动时间延长到180秒,但仍然遇到相同的错误,然后将bin / main.dart文件调整为:

import 'dart:io' show Platform;
import 'package:easyprintbot/easyprintbot.dart';

Future main() async {
  //Getting port from the Process env file 
  var portEnv = Platform.environment['PORT'];
  //Setting port to 8888 if fetch Failed else setting it to the fetched value
  var port = portEnv == null ? 8888 : int.parse(portEnv);
  print("Port: {$port}");
  final app = Application<EasyprintbotChannel>()
      ..options.configurationFilePath = "heroku.yaml"
      ..options.port = port; //setting port to bind to

  await app.startOnCurrentIsolate();

  print("Application started on port: ${app.options.port}.");
  print("Use Ctrl-C (SIGINT) to stop running the application.");
}

重新部署后仍然出现相同的错误

我的 procfile 看起来像这样:

release: /app/dart-sdk/bin/pub global run aqueduct:aqueduct db upgrade --connect $DATABASE_URL
web: /app/dart-sdk/bin/pub global run aqueduct:aqueduct serve --port $PORT --config-path heroku.yaml

和我的 heroku.yaml 看起来像这样:

database: $DATABASE_URL

我在做什么错了?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。