bottender icon indicating copy to clipboard operation
bottender copied to clipboard

Not work in AWS Lambda

Open ange007 opened this issue 4 years ago • 5 comments

Hello. I try setup bot in AWS Lambda, but bot (Telegram) functions are not working.

Example:

module.exports = async function App( context ) {
	const event = context.event;
	
	console.log(event);
	console.log(event.message.from);
	console.log(event.message.chat);

	await context.sendText( `@${event.message.from.username} - Hi!` );

Lambda log:

image

In local that works well. What could be the reason?

ange007 avatar Feb 09 '20 18:02 ange007

Hi @ange007

I have tested some cases and here are some of my findings. Let me know if you have any further question or information 😅

tldr:

The AWS Lambda functions seem to have problem sending requests to the webhook recently. Since the problem had never occurred before when I developed using Lambda + Bottender, I may wait for a few days and check if the problem is still occurring.

Test cases:

  1. AWS + Telegram
  2. AWS + LINE
  3. AWS + Messenger
  4. GCP + Telegram
  5. GCP + LINE
  6. GCP + Messenger

Result:

AWS cases all fail to send text to user. GCP cases all work as expected.

Detailed failed cases:

The AWS Lambda functions now can't send request to the webhook correctly.

Sometimes there's no error message shown and sometimes there're some types of error message will display randomly (See screenshot 1 & 2).

However, when you trigger the function multiples times in a short period, the AWS Lambda functions will actually send the first few requests to the webhook successfully but fail to send the latter ones (See screenshot 3).

Screenshot 1

image

Screenshot 2

image

Screenshot 3

image

HcwXd avatar Feb 10 '20 20:02 HcwXd

Hi. Any idea? Perhaps need add connection settings for the bot? With the ability to change parameters? For fix connection errors?

ange007 avatar Feb 19 '20 15:02 ange007

Has anyone come across this? It doesn’t work for me.

ange007 avatar Mar 09 '20 15:03 ange007

Quick note @ange007. Have you tried setting sync: true for the bot's config in bottender.config? I am only testing locally at the moment but it will immediately return without that setting.

michaelwills avatar Jul 24 '20 22:07 michaelwills

I have same issue but message is different.

無題

kaito3desuyo avatar Feb 15 '21 02:02 kaito3desuyo