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

not working even without any code TelegramError: 404: Not Found #1926

Open
its-dibo opened this issue Jan 6, 2024 · 9 comments
Open

not working even without any code TelegramError: 404: Not Found #1926

its-dibo opened this issue Jan 6, 2024 · 9 comments

Comments

@its-dibo
Copy link

its-dibo commented Jan 6, 2024

 let bot = new Telegraf(token);

// no any other code, just launch the bot

bot.launch()
node_modules/telegraf/lib/core/network/client.js:302
            throw new error_1.default(data, { method, payload });
                  ^

TelegramError: 404: Not Found
    at Telegram.callApi (node_modules/telegraf/lib/core/network/client.js:302:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Telegraf.launch (node_modules/telegraf/lib/telegraf.js:182:78) {
  response: { ok: false, error_code: 404, description: 'Not Found' },
  on: { method: 'getMe', payload: {} }
}

Node.js v20.10.0

@uselessBoi21
Copy link

uselessBoi21 commented Jan 7, 2024

Hey ,
The issue seems to be with the modules pattern used in the specified location in the error.
location :[ node_modules/telegraf/lib/core/network/client.js] uses commonjs module.
I think it needs some fixing to adapt to the ES6 modules from commonjs module pattern
You will be getting the error if you are using the ES6 module ( i.e. import {Telegram} from 'telegraf') kind of import
The commonjs module works fine with the require('telegraf') syntax

@MKRhere
Copy link
Member

MKRhere commented Jan 7, 2024

@uselessBoi21 The library is importable as ESM and CJS. That is not the issue. The server they're making a request to responds with 404. Which sounds to me like they're behind a bad proxy or their ISP is hijacking requests.

@its-dibo
Copy link
Author

The server they're making a request to responds with 404.

it is not the cause of the issue, because using telegram API directly or using other packages works well such as node-telegram-bot-api

@MKRhere
Copy link
Member

MKRhere commented Jan 18, 2024

using telegram API directly

Directly how?

Are you using HTTP_PROXY env vars? I know that cURL and NTBA (via https://github.com/request/request) respect this, but Telegraf doesn't. With Telegraf, you should use https-proxy-agent and pass it as new Telegraf(token, { telegram: { agent } }).

@its-dibo
Copy link
Author

Are you using HTTP_PROXY env vars?

No, just a fresh Nodejs app

@MKRhere
Copy link
Member

MKRhere commented Jan 29, 2024

HTTP_PROXY is not set inside Node. Are you using a VPN service that sets this var, for example?
Anyhow, Telegraf is not able to reach Telegram Bot API, it seems. Can you try doing this?

fetch("https://api.telegram.org").then(res => res.text()).then(console.log)

@its-dibo
Copy link
Author

HTTP_PROXY is not set inside Node. Are you using a VPN service that sets this var, for example? Anyhow, Telegraf is not able to reach Telegram Bot API, it seems. Can you try doing this?

fetch("https://api.telegram.org").then(res => res.text()).then(console.log)

I don't use any proxy or VPN at all

@its-dibo
Copy link
Author

Telegraf is not able to reach Telegram Bot API, it seems. Can you try doing this?

yes

@MKRhere
Copy link
Member

MKRhere commented Jan 31, 2024

And? What's the result?

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

No branches or pull requests

3 participants