Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node simply ends process soon after trying to run my bot #382

Closed
amanape opened this issue Mar 10, 2023 · 9 comments · Fixed by #384
Closed

node simply ends process soon after trying to run my bot #382

amanape opened this issue Mar 10, 2023 · 9 comments · Fixed by #384

Comments

@amanape
Copy link

amanape commented Mar 10, 2023

Everything was working fine earlier today, I run tsc and then node dist/bot.js to run my bot. Then, after deleting node_modules and reinstalling the deps, node immediately ends the process after a second of starting without any error or warning.

yarn run dev

RESPONSE:

yarn run v1.22.19
$ tsc && node dist/bot.js
✨  Done in 1.28s.

The strangest thing of all is that the same behaviour persists even if I replace all the source code in my main bot.ts file with the most basic example

import { Bot } from "grammy";

const TOKEN = ""
const bot = new Bot(TOKEN);

// Reply to any message with "Hi there!".
bot.on("message", (ctx) => ctx.reply("Hi there!"));

bot.start();

package.json

{
  "license": "MIT",
  "version": "0.2.0",
  "scripts": {
    "dev": "tsc && node dist/bot.js",
    "build": "tsc"
  },
  "devDependencies": {
    "typescript": "^4.9.5",
    "vite": "^4.1.4",
    "vitest": "^0.28.5"
  },
  "dependencies": {
    "@grammyjs/conversations": "^1.1.1",
    "@grammyjs/files": "^1.0.4",
    "@types/exceljs": "^1.3.0",
    "grammy": "^1.14.1"
  }
}

Could it be something related to my account or token itself? I tried generating new ones, and node just ended in 3 seconds instead of 1 second but only on the first time I run the command.

@amanape
Copy link
Author

amanape commented Mar 10, 2023

Running DEBUG='*' node dist/bot.js gives me

  grammy:bot Initializing bot +0ms
  grammy:core Calling getMe +0ms
  grammy:bot I am BT11829Bot! +285ms
  grammy:core Calling deleteWebhook +285ms

@jjjj222
Copy link

jjjj222 commented Mar 10, 2023

I faced the same issue (v1.15.0).
Solved by using v1.14.1 instead.

@felixniemeyer
Copy link

I have the same issue regardless of whether I'm using nodemon or deno

[nodemon] clean exit - waiting for changes before restart

@esindger
Copy link

The problem is in this line.

@KnorpelSenf
Copy link
Member

Right, that was stupid. You found it, do you quickly wanna fix it?

@KnorpelSenf
Copy link
Member

@all-contributors add @amanape for bug

@allcontributors
Copy link
Contributor

@KnorpelSenf

I've put up a pull request to add @amanape! 🎉

@KnorpelSenf
Copy link
Member

I'll take this then.

@KnorpelSenf
Copy link
Member

Please review #384.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants