I
I
Ilya55272021-12-19 12:03:17
Java
Ilya5527, 2021-12-19 12:03:17

When launching a telegram bot on heroku, it gives an error H10, how to fix it?

When running a telegram bot on Heroku, it gives the following errors:

2021-12-19T08:29:28.811009+00:00 heroku[web.1]: Process exited with status 1
2021-12-19T08:29:28.928872+00:00 heroku[web.1]: State changed from starting to crashed
2021-12-19T08:34:30.884295+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=testtgbot1.herokuapp.com request_id=a77a8de3-504d-4709-a778-c77984133f59 fwd="93.81.221.81" dyno= connect= service= status=503 bytes= protocol=https
2021-12-19T08:34:31.374086+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=testtgbot1.herokuapp.com request_id=a27748f9-f0b7-4d29-964a-1910d19d9a4f fwd="93.81.221.81" dyno= connect= service= status=503 bytes= protocol=https


main class:

@SpringBootApplication
public class Main {
    public static void main(String[] args) {
        SpringApplication.run(Main.class, args);
    }
}


App class:
@Component
public class Application extends TelegramLongPollingBot {
    @Override
    public String getBotUsername() {
        return "MY_USERNAME";
    }

    @Override
    public String getBotToken() {
        return "MY_TOKEN";
    }

    @SneakyThrows
    @Override
    public void onUpdateReceived(Update update) {
        if (update.hasMessage() && update.getMessage().hasText()){
            if (update.getMessage().getText().equals("/start")){
                execute(new SendMessage().builder().chatId(update.getMessage().getChatId().toString()).text("Я бот, а ты тоже!").build());
            }
        }
    }
}


The documentation says that H10 is an error in the HTTP request, how can I fix it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question