简体   繁体   English

当我打开 heroku 时,我遇到了带有 h10 代码的 Strapi 问题

[英]When i open heroku i have a problem with strapi with h10 code

i have this problem when i open heroku and run heroku logs --tail The app crashed and dont see my app strapi in heroku.................当我打开 heroku 并运行 heroku 日志时遇到这个问题 --tail 应用程序崩溃并且在 heroku 中看不到我的应用程序 strapi。

 2020-05-04T19:05:38.602418+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=strapi-inmobiliaria-gatsby.herokuapp.com request_id=2b5c1e98-7aaf-4362-905f-bf0e17391fe0 fwd="190.244.81.129" dyno= connect= service= status=503 bytes= protocol=https 2020-05-04T19:05:38.862307+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=strapi-inmobiliaria-gatsby.herokuapp.com request_id=629c8bb2-8e68-4b8d-8d35-919c95130eb2 fwd="190.244.81.129" dyno= connect= service= status=503 bytes= protocol=https 2020-05-04T19:13:18.189908+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=strapi-inmobiliaria-gatsby.herokuapp.com request_id=cd2366d2-1851-4ed2-bf70-72d8db61c1c4 fwd="190.244.81.129" dyno= connect= service= status=503 bytes= protocol=https 2020-05-04T19:13:18.538292+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=strapi-inmobiliaria-gatsby.herokuapp.com request_id=c757b34d-7944-4a5b-944b-ae0dcb84affc fwd="190.244.81.129" dyno= connect= service= status=503 bytes= protocol=https

I search the problem but i no sure what it is.我搜索问题,但我不确定它是什么。

Its my package.json它是我的 package.json

 { "name": "bienesraices", "private": true, "version": "0.1.0", "description": "A Strapi application", "scripts": { "develop": "strapi develop", "start": "strapi start", "build": "strapi build", "strapi": "strapi" }, "devDependencies": {}, "dependencies": { "knex": "<0.20.0", "mysql": "latest", "pg": "^8.0.3", "strapi": "3.0.0-beta.20.1", "strapi-admin": "3.0.0-beta.20.1", "strapi-connector-bookshelf": "3.0.0-beta.20.1", "strapi-plugin-content-manager": "3.0.0-beta.20.1", "strapi-plugin-content-type-builder": "3.0.0-beta.20.1", "strapi-plugin-email": "3.0.0-beta.20.1", "strapi-plugin-graphql": "^3.0.0-beta.20.1", "strapi-plugin-upload": "3.0.0-beta.20.1", "strapi-plugin-users-permissions": "3.0.0-beta.20.1", "strapi-utils": "3.0.0-beta.20.1" }, "author": { "name": "A Strapi developer" }, "strapi": { "uuid": "13a8b7a9-81dc-4560-98f1-0ec0ec1769c0" }, "engines": { "node": ">=10.0.0", "npm": ">=6.0.0" }, "license": "MIT" }

 Running printenv on ⬢ strapi-inmobiliaria-gatsby... up, run.3613 (Free) NODE_HOME=/app/.heroku/node NODE_ENV=production WEB_MEMORY=512 DYNO=run.3613 PWD=/app LINES=30 HOME=/app DATABASE_PORT=5432 NODE_MODULES_CACHE=false DATABASE_URL=postgres://cbf************:d0******************************@ec2-52******40.compute-1.amazonaws.com:5432/d3******ntmu PORT=42473 MEMORY_AVAILABLE=512 DATABASE_NAME=d3************mu COLUMNS=120 DATABASE_USERNAME=cbf****** WEB_CONCURRENCY=1 SHLVL=1 PATH=/app/.heroku/node/bin:/app/.heroku/yarn/bin:/usr/local/bin:/usr/bin:/bin:/app/bin:/app/node_modules/.bin

And my procfile i dont know it´s ok我的 procfile 我不知道没关系

web: node config/environments/production/server.json web:节点配置/环境/生产/服务器。json

https://strapi.io/documentation/3.0.0-beta.x/migration-guide/migration-guide-beta.19-to-beta.19.4.html#listened-host-changed https://strapi.io/documentation/3.0.0-beta.x/migration-guide/migration-guide-beta.19-to-beta.19.4.html#listened-host-changed

Because Heroku is expecting Strapi to be running on a publicly accessible port you need to set the host variable in config/environments/*/server.json to use 0.0.0.0 instead of localhost.因为 Heroku 期望 Strapi 在可公开访问的端口上运行,您需要在config/environments/*/server.json中设置host变量以使用0.0.0.0而不是 localhost。

(The Strapi Heroku guide is not up to date yet) (Strapi Heroku 指南尚未更新)

I just added self assigned SSL object from strapi docs and it works.我刚刚从strapi docs添加了自分配的SSL object,它可以工作。 Add the rows into database.js file by follow below steps.按照以下步骤将行添加到database.js文件中。

ssl: {
        rejectUnauthorized: env.bool('DATABASE_SSL_SELF', false), // For self-signed certificates
    },
    options: {
        ssl: env.bool('DATABASE_SSL', false),
    }, `

Complete database.js file looks like完整的database.js文件看起来像

module.exports = ({
        env
    }) => ({
        defaultConnection: 'default',
        connections: {
            default: {
                connector: 'bookshelf',
                settings: {
                    client: 'postgres',
                    host: env('DATABASE_HOST', '127.0.0.1'),
                    port: env.int('DATABASE_PORT', 5432),
                    database: env('DATABASE_NAME', 'strapi'),
                    username: env('DATABASE_USERNAME', ''),
                    password: env('DATABASE_PASSWORD', ''),
                    //add this line
                    ssl: {
                        rejectUnauthorized: env.bool('DATABASE_SSL_SELF', false), // For self-signed certificates
                    },
                },
                // add this line
                options: {
                    ssl: env.bool('DATABASE_SSL', false),
                },
            },
        },
    });

And my server.js file looks like我的server.js文件看起来像

module.exports = ({
    env
}) => ({
    host: env('HOST', '0.0.0.0'),
    port: env.int('PORT', 1337),
    admin: {
        auth: {
            secret: env('ADMIN_JWT_SECRET', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'),
        },
    },
});

added this too and it's working now..也添加了这个,它现在正在工作..

 ssl: {
     rejectUnauthorized: env.bool('DATABASE_SSL_SELF', false), // For self-signed certificates
            },
          },
          options: {
            ssl: env.bool('DATABASE_SSL', false),
          },

Add the following line at end of.gitignore在.gitignore 的末尾添加以下行

package-lock.json封装锁.json

and delete file并删除文件

package-lock.json封装锁.json

it helped me:)它帮助了我:)

暂无
暂无

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

相关问题 部署 Heroku 时应用程序崩溃(代码 h10) - App Crashing when Deploying Heroku (Code h10) 修复 Heroku 以状态 1 退出,错误代码 H10 - Fixing Heroku exited with status 1, error code H10 我正在尝试部署 Heroku,但出现此错误 - code = H10, desc = app crashed method=GET path=&quot;/&quot; status=503 - I am trying to deploy Heroku and I am getting this error - code = H10, desc = app crashed method=GET path="/" status=503 第一次将 Express 后端部署到 Heroku 2 错误代码 h10 进程以状态 1 退出 - First time deploying an express backend to Heroku 2 error code h10 Process exited with status 1 Heroku 无法启动我的 app.js(代码 H10 状态 503) - Heroku Couldn't start my app.js (Code H10 status 503) Heroku Node.js 错误代码 H10“应用程序崩溃” - Heroku Node.js error code H10 "App crashed" 应用程序前端的 Heroku 应用程序崩溃 h10 错误 - Heroku app crash h10 error on app's frontend 我的h4内容提取代码有问题 - I have a problem with the h4 content extraction code 我有一个问题,此代码有效并连接到 atlas 云。 但是当我尝试在 heroku 上运行它时,它卡住了。 如果它的结构不正确? - I have a problem, this code works and connects into atlas cloud. But when i try to run it on heroku , it gets stuck. if its not properly structured? Heroku部署错误H10; 错误:找不到模块&#39;/ app / console` - Heroku deployment error H10; Error: Cannot find module '/app/console`
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM