我的 Discord 机器人运行良好一段时间,但随后“无法在启动后 60 秒内绑定到 $PORT”
我尝试了不同的方法并查看了所有其他回复,但我不知道如何解决它
错误 R10(启动超时)-> Web 进程未能在启动后 60 秒内绑定到 $PORT 2022-03-19T09:15:18.022903+00:00 heroku[web.1]:使用 SIGKILL 停止进程 2022-03-19T09:15:18.059850+00:00 app[web.1]:等待进程终止时出错:没有子进程 2022-03-19T09:15:18.210022+00:00 heroku[web.1]:进程已退出,状态为 22 2022-03-19T09:15:18.331083+00:00 heroku[web.1]:状态从开始变为
代码崩溃:
require('dotenv').config();
const OpenAI = require('openai-api');
const openai = new OpenAI(process.env.OPENAI_API_KEY);
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
let prompt =`text here`;
client.on("message", function (message) {
if (message.author.bot) return;
prompt += `You: ${message.content}\n`;
(async () => {
const gptResponse = await openai.complete({
engine: 'davinci',
prompt: prompt,
maxTokens: 80,
temperature: 0.7,
topP: 1,
presencePenalty: 0,
frequencyPenalty: 0,
bestOf: 1,
n: 1,
stream: false,
stop: ['\n', '\n\n']
});
message.reply(`${gptResponse.data.choices[0].text.substring(5)}`);
prompt += `${gptResponse.data.choices[0].text}\n`;
})();
});
client.login(process.env.BOT_TOKEN);
我的 procfile 是空的,但它仍然可以工作 60 秒 有什么想法吗? 编辑:我尝试过但不起作用的事情 我尝试更改 procfile 以将
worker: node index.js
procfile 包含到 worker: java -jar build/libs/*.jar
I've tried different approaches and looked at all the other replies but i dont know how to adress it
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2022-03-19T09:15:18.022903+00:00 heroku[web.1]: Stopping process with SIGKILL
2022-03-19T09:15:18.059850+00:00 app[web.1]: Error waiting for process to terminate: No child processes
2022-03-19T09:15:18.210022+00:00 heroku[web.1]: Process exited with status 22
2022-03-19T09:15:18.331083+00:00 heroku[web.1]: State changed from starting to crashed
the code:
require('dotenv').config();
const OpenAI = require('openai-api');
const openai = new OpenAI(process.env.OPENAI_API_KEY);
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
let prompt =`text here`;
client.on("message", function (message) {
if (message.author.bot) return;
prompt += `You: ${message.content}\n`;
(async () => {
const gptResponse = await openai.complete({
engine: 'davinci',
prompt: prompt,
maxTokens: 80,
temperature: 0.7,
topP: 1,
presencePenalty: 0,
frequencyPenalty: 0,
bestOf: 1,
n: 1,
stream: false,
stop: ['\n', '\n\n']
});
message.reply(`${gptResponse.data.choices[0].text.substring(5)}`);
prompt += `${gptResponse.data.choices[0].text}\n`;
})();
});
client.login(process.env.BOT_TOKEN);
my procfile is empty but it still works for 60 seconds
any ideas?
edit: THINGS I TRIED THAT DONT WORK
i tried changing procfile to contain
worker: node index.js
procfile to worker: java -jar build/libs/*.jar
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用名称
Procfile
而不是procfile
,否则 heroku 不会知道您需要工作进程而不是默认的 Web 进程。Use the name
Procfile
instead ofprocfile
, otherwise heroku doesn't learns that you need worker process and not the default web process.