Nuxt在刷新页面时超时

时间:2018-11-22 14:46:29

标签: vue.js ssr nuxt

Nuxt版本

v2.2.0

复制链接

https://stage.empleos.io/

复制步骤

打开链接(Nuxt应用程序加载正常) 点击刷新-应用超时,错误代码为500。

期望什么?

刷新页面不会导致应用超时。

实际情况是什么?

该应用程序超时。

其他评论?

Nuxt使用路由器模块(@nuxtjs/router)在SSR模式下工作。

应用程序已部署在heroku上。我也在该应用程序中使用vuex。

REST API也托管在heroku上,并使用asyncData()从服务器端调用。

Router.js

import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

const routes = [

    // -------------------  Guest Access ---------------------------------

    {
        path: '/',
        name: 'home',
        component: () => import('@/pages/home/index').then(m => m.default || m),
        meta: {},
    },

    {
        path: '/abc',
        name: 'abc',
        component: () => import('~/pages/abc').then(m => m.default || m),
        meta: {
            guest: true,
        },
    },

    // --------------- Default route  ------------------------
    {
        path: '/',
        redirect: '/',
    }, {
        path: '/*',
        redirect: '/',
    },
];

const router = new Router({
    mode: 'history',
    scrollBehavior(to, from, savedPosition) {
        if (savedPosition) {
            return savedPosition;
        }
        return { x: 0, y: 0 };
    },
    routes,
});

export function createRouter() {
    return router;
}

export default router;

Heroku前端日志:

2018-11-22T14:01:50.223631+00:00 heroku[router]: at=info method=GET path="/_nuxt/ce52151fd63d02c9c13f.js" host=stage.empleos.io request_id=129541f8-7f10-47bb-b004-7991ca2ba50b fwd="95.135.36.67" dyno=web.1 connect=26ms service=19ms status=200 bytes=6167 protocol=http
2018-11-22T14:01:50.217303+00:00 heroku[router]: at=info method=GET path="/_nuxt/e6f91fcbcd3a78ab8382.js" host=stage.empleos.io request_id=876329ba-57f3-4a1c-8984-bdf6277549ff fwd="95.135.36.67" dyno=web.1 connect=28ms service=16ms status=200 bytes=4509 protocol=http
2018-11-22T14:01:50.690209+00:00 heroku[router]: at=info method=GET path="/_nuxt/img/67028a6.jpg" host=stage.empleos.io request_id=b25b9a50-ffb2-4d63-928e-ff70717e94d0 fwd="95.135.36.67" dyno=web.1 connect=0ms service=2ms status=200 bytes=5020 protocol=http
2018-11-22T14:03:06.912653+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=stage.empleos.io request_id=d4fbaff0-2651-4927-9acf-da5302d4526b fwd="95.135.36.67" dyno=web.1 connect=0ms service=30003ms status=503 bytes=0 protocol=http
2018-11-22T14:03:22.547695+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=stage.empleos.io request_id=3283bee0-de9f-476c-97ce-e8349865c83a fwd="95.135.36.67" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0 protocol=http
2018-11-22T14:03:23.736796+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=stage.empleos.io request_id=62022ef0-3c9b-45cc-927c-6b3ac452c5a0 fwd="95.135.36.67" dyno=web.1 connect=1ms service=13ms status=200 bytes=653 protocol=http
2018-11-22T14:05:23.976900+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=stage.empleos.io request_id=bf69b658-e5d8-411b-abd6-9824ffd54eb2 fwd="95.135.36.67" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=http
2018-11-22T14:10:53.815023+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=stage.empleos.io request_id=57ccd2f4-1f18-49e8-b0c9-f80ea2346559 fwd="95.135.36.67" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=http
2018-11-22T14:11:16.913300+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=stage.empleos.io request_id=0894d69e-2315-4c54-9b4e-f050d862b1f0 fwd="182.77.56.233" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=https
2018-11-22T14:23:00.338549+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=stage.empleos.io request_id=223a7f2f-ba2f-4943-9703-6097f8fa2c93 fwd="182.77.56.233" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=https
2018-11-22T14:39:18.247681+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=stage.empleos.io request_id=36ba1255-f02e-44ea-adcb-ae7fe1dcde44 fwd="182.77.56.233" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0 protocol=https
2018-11-22T14:39:23.533257+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=stage.empleos.io request_id=2518f8bf-dcb3-4f48-ac33-80f8db6d4e38 fwd="182.77.56.233" dyno=web.1 connect=1ms service=9ms status=200 bytes=653 protocol=https

0 个答案:

没有答案