Comments (13)
strange. do you know what was the API call you made ? also did you change anything when creating the constructor ?
as for the logger you can import the Logger
class and use Logger.setLevel("anything here");
to remove it. there are 4 levels
levels = ['error', 'warn', 'info', 'debug'];
from gramjs.
The API call was users.GetFullUser
I made a smaller node js application to reproduce it:
const { TelegramClient } = require('telegram/dist')
const { StringSession } = require('telegram/dist/sessions');
const teletl = require('telegram/dist/tl');
const readline = require('readline');
const { Logger } = require('telegram/dist/extensions');
const apiId = process.env.API_ID // put your api id here [for example 123456789]
const apiHash = process.env.API_HASH // put your api hash here [for example '123456abcfghe']
const client = new TelegramClient(new StringSession(process.env.STRING_SESSION), apiId, apiHash, {
connectionRetries: 3,
})
var username = 'justanotherlight';
client.start();
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
Logger.setLevel("debug");
rl.question('make getfulluser? y for yes ', async (choice) => {
if (choice != 'y') {
return;
}
client.invoke(new teletl.Api.users.GetFullUser({ id: username }))
.then((res) => console.log(res))
.catch((err) => {
console.log(err);
});
rl.close();
});
Apparently making multiple requests one after the other works if I do it in the above code, but if I wait and do nothing for like 30 seconds, it shows this
[2021-03-11T11:23:15.453Z] [INFO] - [connection closed]
{ Error: Invalid checksum (2699144061 when 2396756994 was expected). This packet should be skipped.
at FullPacketCodec.<anonymous> (/home/null/apps/test-gramjs/node_modules/telegram/dist/network/connection/TCPFull.js:53:23)
at Generator.next (<anonymous>)
at fulfilled (/home/null/apps/test-gramjs/node_modules/telegram/dist/network/connection/TCPFull.js:5:58)
at process._tickCallback (internal/process/next_tick.js:68:7) checksum: 2699144061, validChecksum: 2396756994 }
does it mean that I should do a client.start
for every request if the requests are not that frequent(like a few minutes to a few hours)?
from gramjs.
that's very weird. I tried your code and it's been running fine for 10 min. are you sure you're not using a VPN or have an IPV6 or something weird like that ?
from gramjs.
Yea no it doesn't I think, one network I tried on had IPv6, but it had the same error as with the IPv4 one. Putting it on Heroku gives me the same thing too. So basically I see the same error message on different networks and different machines, so I can't make more than one request since the client is disconnected. Also, I don't use a VPN.
What should I be doing to fix this?
Is there any more information that I can provide to solve this problem?
from gramjs.
Also get this error. In my case I called messages.GetHistory
await telegram.invoke(new Api.messages.GetHistory({
peer: new Api.InputPeerChat({
chatId: parseInt(id)
})
}));
from gramjs.
well one thing for sure is that ipv6 is not supported.
As for getHistory try to pass the id directly instead of an InputPeerChat. It's very weird that this is happening.
from gramjs.
Yes, already tried that, but got the same error. Is there any recommendation?
from gramjs.
which error are you getting btw the disconnect one ?
from gramjs.
same as the author, the Invalid checksum error
from gramjs.
I reinstalling everything and I haven't found any issue from checksum error.
All I did are removing yarn.lock and node_modules then ran yarn install
Thank you for your help @painor
from gramjs.
Sorry, seems the invalid checksum error is reapearring this morning. I suspect the network, but then I tried to run the same function in telethon and it ran successfully.
Does anyone have any idea why does this error reoccurring despite having no code changes?
from gramjs.
I think the issue was in the TCP connection reader on slower connections. It might have been fixed in latest patch. you could also use connection:ConnectionTCPObfuscated
in the args to try if it's better.
const client = new TelegramClient(new StringSession(stringSession), apiId, apiHash, { connection:ConnectionTCPObfuscated })
from gramjs.
Yes, looks like it's fixed now. Thanks!
from gramjs.
Related Issues (20)
- Π‘an't get messages using offsetDate that were sent before being added to the telegram group
- EventHandler triggered by some channels and not from some others HOT 1
- Option useIPV6 not working
- Implement requestSimpleWebView HOT 1
- Extract hyperlink from message HOT 3
- The account gets banned immediately after running the sample code HOT 1
- Support http links in parseUsername? HOT 1
- TIME_INVALID and other time_ms related errors returned for InputGroupCallStream HOT 1
- How to reduce inbound or outbound data transfer
- RPCError: 400: FILTER_ID_INVALID (caused by messages.UpdateDialogFilter) HOT 1
- [Disconnecting...] multiple times??
- How to get the information of the telegram group using name? HOT 1
- How to create a public group using this? HOT 1
- How to kick a user from a group. HOT 1
- NewMessage event not working for majority of channels all of a sudden HOT 7
- How to open webview app HOT 1
- Can't connect via ipv6 proxy
- NewMessage event not working for some channels. HOT 2
- RequestWebView missing parameters HOT 1
- Wrong returned type for createForumTopic
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gramjs.