簡體   English   中英

Heroku 保持超時:等待網絡時出錯:資源暫時不可用

[英]Heroku Keeps timing out: Error waiting for network: Resource temporarily unavailable

我的 index.js 文件:

const Discord = require('discord.js');
const levels = require('discord-xp');
const client = new Discord.Client();
const mongoose = require('./database/mongoose');
const fs = require(`fs`);
require('dotenv').config();
const port = process.env.PORT || 5000;
const host = '0.0.0.0';

const chalk = require('chalk');
const { Player } = require('discord-player');
const Gamedig = require('gamedig');

client.prefix = (`${process.env.PREFIX}`);
client.commands = new Discord.Collection();

client.player = new Player(client);
client.config = require('./config/bot');
client.emotes = client.config.emojis;
client.filters = client.config.filters;

fs.readdirSync('./commands').forEach(dirs => {
    const commands = fs.readdirSync(`./commands/${dirs}`).filter(files => files.endsWith('.js'));

    for (const file of commands) {
        const command = require(`./commands/${dirs}/${file}`);
        console.log(`Loading command ${file}`);
        client.commands.set(command.name.toLowerCase(), command);
    };
});
const player = fs.readdirSync(`./player`).filter(file => file.endsWith('.js'));
const events = fs.readdirSync('./events').filter(file => file.endsWith('.js'));


for (const file of player) {
    console.log(`Loading discord-player event ${file}`);
    const event = require(`./player/${file}`);
    client.player.on(file.split(".")[0], event.bind(null, client));
};
for (const file of events) {
    console.log(`Loading discord.js event ${file}`);
    const event = require(`./events/${file}`);
    client.on(file.split(".")[0], event.bind(null, client));
};

mongoose.init();
client.login(process.env.TOKEN)

我的檔案:

Worker: node index.js

我的 package.json:

{
    "name": "icrp-bot",
    "version": "1.0.0",
    "description": "Made For ICRP ",
    "main": "index.js",
    "scripts": {
      "test": ".test",
      "start": "node index.js"
    },
    "author": "Bombo43453#1901",
    "license": "ISC",
    "dependencies": {
      "axios": "^0.21.1",
      "baseplayer": "^0.2.9",
      "chalk": "^4.1.1",
      "discord-fivem-api": "^1.0.4",
      "discord-player": "^3.4.0",
      "discord-xp": "^1.1.14",
      "discord.js": "^12.5.3",
      "dotenv": "^8.2.0",
      "ffmpeg-static": "^4.3.0",
      "gamedig": "^3.0.1",
      "log-timestamp": "^0.3.0",
      "moment": "^2.29.1",
      "moment-timezone": "^0.5.33",
      "mongoose": "^5.11.14",
      "node-gyp": "^8.0.0",
      "opus": "0.0.0",
      "opusscript": "0.0.8",
      "pm2": "^4.5.6",
      "python": "0.0.4",
      "rebuild": "^0.1.2"
    }
}

完全錯誤:

2021-04-23T17:18:33.808571+00:00 heroku[Worker.1]: State changed from down to starting
2021-04-23T17:18:43.196477+00:00 heroku[Worker.1]: Starting process with command `node index.js`
2021-04-23T17:18:43.846098+00:00 heroku[Worker.1]: State changed from starting to up
2021-04-23T17:18:43.854420+00:00 heroku[Worker.1]: Idling
2021-04-23T17:18:43.856605+00:00 heroku[Worker.1]: State changed from up to down
2021-04-23T17:18:43.870047+00:00 heroku[Worker.1]: Idling because quota is exhausted
2021-04-23T17:18:50.422071+00:00 app[Worker.1]: Error waiting for network: Resource temporarily unavailable

信息:這是我為 Fivem 服務器制作的簡單機器人。 我嘗試使用 heroku 托管它並嘗試修復它。 我嘗試添加一個端口 const 和一個 const 主機,但這並沒有解決任何問題。 我還認為我的問題非常小,我在 heroku 上還有 200 個小時,這意味着時間不是問題。 我也嘗試將端口更改為 8080,但沒有任何幫助。 如果你有想法請告訴我。

我知道你說你還有200個小時。
但是Idling because quota is exhausted僅在您用完空閑時間時才會顯示。

您還說您將端口更改為 8080,但請注意,您無法更改 HEROKU上的端口,您將端口作為 env 變量(就像您在上面所做的process.env.PORT一樣)並且您無法更改它。

如果您使用的是 worker,這意味着您無法運行 web 進程,並且 PORT 無論如何也沒用。

關於您的最后一個錯誤,這是來自 Heroku 支持
This is caused by kernel-level issues that can surface occasionally on the backend instances that dynos run on. Unfortunately, there is not really a work around for this issue. Scheduler dynos will crash if this happens and the job will not be executed again until its next scheduled run time. Other dyno types will typically enter a bad state and require a manual restart (you may see "App boot timeout" errors when this happens). 檢查這個

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM