A
A
ALEXANDR PETRIN2021-05-16 15:28:57
Amazon Web Services
ALEXANDR PETRIN, 2021-05-16 15:28:57

How to run Telegraf in AWS-Lambda?

I created in the API Gateway —> REST API —> I create a resource (I write Resource Path in it) —> I add a method (POST) —> Deploy
I created Lambda (nodejs ^ 14) and uploaded the code from the official Telegraf ^ 4.3 documentation example in an archive . Nothing works...

const Telegraf = require('telegraf')
const makeHandler = require('lambda-request-handler')

const token = '18**82**7**AA**PH**1S**Vn**1M**8p**A4**qb**Kc'
if (token === undefined) {
    throw new Error('BOT_TOKEN must be provided!')
}

const bot = new Telegraf(token, {
    telegram: { webhookReply: true }
})

bot.start((ctx) => ctx.reply('Hello'))

export const handler = makeHandler(
    bot.webhookCallback('/<INVOKE_URL>')
)


Please, any advice? Simple working code examples? Does anyone know how to check the code for errors?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Shumov, 2021-05-16
@inoise

All lambda logs are from cloud watch. In api gateway, you can run test directly from the configurator

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question