grammyjs / grammY

The Telegram Bot Framework.
https://grammy.dev
MIT License
2.17k stars 110 forks source link

HTTP headers are attempted to be set after the response is send #542

Closed d0ctr closed 4 months ago

d0ctr commented 5 months ago

Have received such error, I suppose some of the grammy's code is the reason.

node:_http_outgoing:696

throw new ERR_HTTP_HEADERS_SENT('set');

^
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (node:_http_outgoing:696:11)
at ServerResponse.header (/app/node_modules/express/lib/response.js:794:10)
at respond (/app/node_modules/grammy/out/convenience/frameworks.js:108:13)
at Object.send (/app/node_modules/grammy/out/convenience/webhook.js:39:23)
at ApiClient.call (/app/node_modules/grammy/out/core/client.js:34:49)
at t (/app/node_modules/@grammyjs/files/out/plugin.js:29:27)
at ApiClient.call (/app/node_modules/grammy/out/core/client.js:10:41)
at ApiClient.callApi (/app/node_modules/grammy/out/core/client.js:86:33)
at Api.sendChatAction (/app/node_modules/grammy/out/core/api.js:463:25)
at Context.replyWithChatAction (/app/node_modules/grammy/out/context.js:839:25) {
code: 'ERR_HTTP_HEADERS_SENT'
}
Node.js v21.1.0
KnorpelSenf commented 5 months ago

That is possible. Do you use the "express" adapter? Can you share some code that lets us reproduce the problem?

KnorpelSenf commented 4 months ago

Closing due to inactivity