React app CodeShip-Heroku部署:初始构建因503错误代码而中断

问题描述 投票:0回答:1

我正在使用CodeShip和Heroku部署我的React前端。我可以打开该应用程序,但是CodeShip显示该版本已损坏,原因是:

Trying (1 of 6) 'wget --no-check-certificate --output-document=/dev/null http://******.herokuapp.com'
--2020-03-11 21:59:01--  http://******.herokuapp.com/
Resolving ******.herokuapp.com (******.herokuapp.com)... 52.214.138.78, 54.77.242.148, 54.171.40.67, ...
Connecting to ******.herokuapp.com (******.herokuapp.com)|52.214.138.78|:80... connected.
HTTP request sent, awaiting response... 503 Service Unavailable
2020-03-11 21:59:35 ERROR 503: Service Unavailable.

但是当我打开根网址后检查Heroku日志时,得到的却是Error 503

2020-03-11T22:12:59.322877+00:00 heroku[router]: at=info method=GET path="/" host=******.herokuapp.com request_id=57f74e93-a951-4179-ae00-3761976d2656 fwd="176.63.10.67" dyno=web.1 connect=0ms service=3ms status=304 bytes=173 protocol=https
2020-03-11T22:12:59.389496+00:00 heroku[router]: at=info method=GET path="/sockjs-node" host=******.herokuapp.com request_id=516c3825-2bc9-4dfd-a4b9-7a84d2b40bf4 fwd="176.63.10.67" dyno=web.1 connect=1ms service=32093ms status=101 bytes=129 protocol=https
2020-03-11T22:12:59.475750+00:00 heroku[router]: at=info method=GET path="/static/js/0.chunk.js" host=******.herokuapp.com request_id=ab42c365-d66e-4439-be0a-525f425ebec5 fwd="176.63.10.67" dyno=web.1 connect=0ms service=32ms status=304 bytes=176 protocol=https
2020-03-11T22:12:59.476304+00:00 heroku[router]: at=info method=GET path="/static/js/main.chunk.js" host=******.herokuapp.com request_id=a78e6524-3792-42d6-8fab-760aa27aea3b fwd="176.63.10.67" dyno=web.1 connect=1ms service=32ms status=304 bytes=174 protocol=https
2020-03-11T22:12:59.451102+00:00 heroku[router]: at=info method=GET path="/static/js/bundle.js" host=******.herokuapp.com request_id=9e4977bc-ab8e-4cd5-8500-b3ebc411feaa fwd="176.63.10.67" dyno=web.1 connect=0ms service=5ms status=304 bytes=174 protocol=https
2020-03-11T22:12:59.793691+00:00 heroku[router]: at=info method=GET path="/manifest.json" host=******.herokuapp.com request_id=3b248e90-9da2-472a-9653-f0d25f840d76 fwd="176.63.10.67" dyno=web.1 connect=1ms service=6ms status=304 bytes=237 protocol=https
2020-03-11T22:12:59.809653+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=******.herokuapp.com request_id=7dab8f56-c457-42a1-a190-37f8a0a687fd fwd="176.63.10.67" dyno=web.1 connect=1ms service=21ms status=200 bytes=9780 protocol=https

'/'根路径在我的React代码中返回它:

//App.js
<PublicRoute exact path='/' component={Home} layout={LandingLayout} />

//PublicRoute.js
const PublicRoute = ({ component: Component, layout: Layout, ...rest }) => (
    <Route {...rest} render={props => (
        <Layout>
            <Component {...props} />
        </Layout>
    )}
    />
);

//Home.js
import React, { Component } from 'react';

export default class Home extends Component {
  static displayName = Home.name;

  render () {
    return (
      <div>
      </div>
    );
  }
}

我应该如何解决此问题?

reactjs heroku continuous-delivery http-status-code-503 codeship
1个回答
0
投票

平淡无奇的回答有点令人遗憾:我正在使用heroku的免费版本,这可能会导致应用程序启动时资源较少,并且速度变慢。

it seems所有heroku应用程序构建过程都具有30秒的超时限制,如果达到该限制,该超时限制将发回H12 Request timout错误。

如果从Heroku将-----> Build succeeded!消息记录到CodeShip之后立即手动继续调用应用程序,由于某种随机原因,我会得到更快的响应,并且在这种情况下构建不会中断。

您可以在图像上看到,这就是我之前完成的工作。为了进行测试,我再次重新启动了构建,并且没有手动打开应用程序。达到30秒超时,并且构建已中断。

enter image description here

再试一次,继续刷新它的确再次发送回200 OK代码的heroku应用程序URL。

Trying (1 of 6) 'wget --no-check-certificate --output-document=/dev/null http://******.herokuapp.com'
--2020-03-14 14:59:15--  http://******.herokuapp.com/
Resolving ******.herokuapp.com (******.herokuapp.com)... 34.255.174.179, 52.18.75.143, 52.208.237.242, ...
Connecting to ******.herokuapp.com (******.herokuapp.com)|34.255.174.179|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1700 (1.7K) [text/html]
Saving to: /dev/null

enter image description here

阅读heroku文档,很明显,没有确切的答案来处理这个问题。应用程序的长循环或繁重的计算需求很容易导致30秒超时。

无论如何,我的应用程序是轻量级的,没有严肃的逻辑,只有React本身有很多依赖性。这种方式并不是自动化交付,因此我将联系Heroku,并尝试找出它是否真的是免费版本的问题。

编辑:

结果Heroku不为免费用户提供任何支持,而是将您重定向到stackoverflow.com:

enter image description here

我猜这个圆圈是完整的。

© www.soinside.com 2019 - 2024. All rights reserved.