Yoctol / bottender

⚡️ A framework for building conversational user interfaces.
https://bottender.js.org
MIT License
4.21k stars 333 forks source link

Not work in AWS Lambda #648

Open ange007 opened 4 years ago

ange007 commented 4 years ago

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?

HcwXd commented 4 years ago

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

ange007 commented 4 years ago

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

ange007 commented 4 years ago

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

michaelwills commented 4 years ago

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.

kaito3desuyo commented 3 years ago

I have same issue but message is different.

無題