Giter VIP home page Giter VIP logo

Comments (12)

levlam avatar levlam commented on July 19, 2024

Likely, you are trying to parse as JSON an HTTP response with an error HTTP code and an empty body.

You should be able to log raw response received by your HTTP client, or see it in the Bot API server log with log verbosity level set to 4 or bigger.

from telegram-bot-api.

dm-sizov avatar dm-sizov commented on July 19, 2024

You should be able to log raw response received by your HTTP client, or see it in the Bot API server log with log verbosity level set to 4 or bigger.

I got the response body and it's really empty. Is there any way to fix this? What could be the problem with a request containing binary data?

from telegram-bot-api.

levlam avatar levlam commented on July 19, 2024

You received an HTTP error code and error message, which describes the cause of the error, and why the request was incorrect.

from telegram-bot-api.

dm-sizov avatar dm-sizov commented on July 19, 2024

You received an HTTP error code and error message, which describes the cause of the error, and why the request was incorrect.

No error message, only 400 Bad Request.

from telegram-bot-api.

levlam avatar levlam commented on July 19, 2024

Then see server logs with big enough verbosity level.

from telegram-bot-api.

dm-sizov avatar dm-sizov commented on July 19, 2024

Then see server logs with big enough verbosity level.

[ 4][t 5][1709082263.223197460][HttpReader.cpp:260][!HttpInboundConnection] Parsing multipart form data in state 0 with already read length 0
[ 4][t 5][1709082263.223212480][HttpReader.cpp:260][!HttpInboundConnection] Parsing multipart form data in state 1 with already read length 0
[ 4][t 5][1709082263.223227262][HttpReader.cpp:292][!HttpInboundConnection] Parse headers in multipart form data: "content-disposition:form-data; name="method"
[ 4][t 5][1709082263.223249197][HttpReader.cpp:260][!HttpInboundConnection] Parsing multipart form data in state 2 with already read length 0
[ 4][t 5][1709082263.223266363][HttpConnectionBase.cpp:156][!HttpInboundConnection] Can write to the connection
[ 4][t 5][1709082263.223281860][BufferedFd.h:140][!HttpInboundConnection] Nothing to write to [fd:32]
[ 4][t 5][1709082263.223468303][HttpConnectionBase.cpp:102][!HttpInboundConnection] Can read from the connection
[ 4][t 5][1709082263.223514556][BufferedFd.h:206][!HttpInboundConnection] Flush read: +216B[total:216B]
[ 4][t 5][1709082263.223533153][HttpReader.cpp:260][!HttpInboundConnection] Parsing multipart form data in state 2 with already read length 9
[ 4][t 5][1709082263.223549604][HttpReader.cpp:459][!HttpInboundConnection] Get ordinary parameter in multipart form data: "method": "sendVideo"
[ 4][t 5][1709082263.223565101][HttpReader.cpp:260][!HttpInboundConnection] Parsing multipart form data in state 4 with already read length 0
[ 4][t 5][1709082263.223580360][HttpReader.cpp:260][!HttpInboundConnection] Parsing multipart form data in state 1 with already read length 0
[ 4][t 5][1709082263.223596334][HttpReader.cpp:292][!HttpInboundConnection] Parse headers in multipart form data: "content-disposition:form-data; name="chat_id"
"
[ 4][t 5][1709082263.223618745][HttpReader.cpp:260][!HttpInboundConnection] Parsing multipart form data in state 2 with already read length 0
[ 4][t 5][1709082263.223635196][HttpReader.cpp:459][!HttpInboundConnection] Get ordinary parameter in multipart form data: "chat_id": "828772351"
[ 4][t 5][1709082263.223650455][HttpReader.cpp:260][!HttpInboundConnection] Parsing multipart form data in state 4 with already read length 0
[ 4][t 5][1709082263.223665475][HttpReader.cpp:260][!HttpInboundConnection] Parsing multipart form data in state 1 with already read length 0
[ 4][t 5][1709082263.223681688][HttpConnectionBase.cpp:156][!HttpInboundConnection] Can write to the connection
[ 4][t 5][1709082263.223696708][BufferedFd.h:140][!HttpInboundConnection] Nothing to write to [fd:32]
[ 4][t 5][1709082263.223715066][HttpReader.cpp:260][!HttpInboundConnection] Parsing multipart form data in state 1 with already read length 0
[ 4][t 5][1709082263.223734140][HttpConnectionBase.cpp:156][!HttpInboundConnection] Can write to the connection
[ 4][t 5][1709082263.223751544][BufferedFd.h:140][!HttpInboundConnection] Nothing to write to [fd:32]
[ 4][t 5][1709082263.241710901][HttpConnectionBase.cpp:102][!HttpInboundConnection] Can read from the connection
[ 4][t 5][1709082263.241833209][BufferedFd.h:206][!HttpInboundConnection] Flush read: +3672B[total:3672B]
[ 3][t 5][1709082263.241864442][HttpConnectionBase.cpp:134][!HttpInboundConnection] [Error : 400 : Bad Request: Invalid chunk size [size:29215172]]

from telegram-bot-api.

levlam avatar levlam commented on July 19, 2024

Currently, Bot API server doesn't support https://en.wikipedia.org/wiki/Chunked_transfer_encoding with chunks of length bigger than 15 MB.
You can change the constant in the file td/tdnet/td/net/HttpChunkedByteFlow.h at line 20 from 15 << 20, for example, to 256 << 20 and rebuild Bot API server after the change.

from telegram-bot-api.

dm-sizov avatar dm-sizov commented on July 19, 2024

Currently, Bot API server doesn't support https://en.wikipedia.org/wiki/Chunked_transfer_encoding with chunks of length bigger than 15 MB. You can change the constant in the file td/tdnet/td/net/HttpChunkedByteFlow.h at line 20 from 15 << 20, for example, to 256 << 20 and rebuild Bot API server after the change.

Good, thank you. But why is the behavior of the local API differs from the global API? It successfully handles these requests

from telegram-bot-api.

levlam avatar levlam commented on July 19, 2024

At api.telegram.org requests are handled by NGINX and are proxied to the server using Content-Length encoding.

from telegram-bot-api.

dm-sizov avatar dm-sizov commented on July 19, 2024

At api.telegram.org requests are handled by NGINX and are proxied to the server using Content-Length encoding.

Is it possible to deploy NGINX so that there will be minimal differences from api.telegram.org?
Can you add a recommended config for such cases?
Maybe something like this.

from telegram-bot-api.

levlam avatar levlam commented on July 19, 2024

I can't help with NGINX deployment for your scenario, but it should be pretty easy.

from telegram-bot-api.

dm-sizov avatar dm-sizov commented on July 19, 2024

Fixed with NGINX. Thanks for your help!

Maybe something like this.

from telegram-bot-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.