Telegram Bot - URL of webhook dissapears - amazon-web-services

I have a telegram bot which uses a webhook (API Gateway - AWS). The code of the bot is stored in a lambda and works correctly.
If I use the command getWebHookInfo this is what I get:
{"ok":true,"result":{"url":"https://mywebhook-api.eu-west-3.amazonaws.com","has_custom_certificate":false,"pending_update_count":0,"max_connections":40,"ip_address":"10.100.100.100","allowed_updates":["message","inline_query","callback_query"]}}
Then, whenever I send a message the url of the webhook disappears and I don't get any last error message. This is what I get if I use again the getWebHookInfo command:
{"ok":true,"result":{"url":"","has_custom_certificate":false,"pending_update_count":1,"allowed_updates":["message","inline_query","callback_query"]}}
Also, if I do a post request in Postman emulating a Telegram message the code works correctly and I will also receive an answer for the pending message !
It doesn't seems an error of the webhook, and for sure it's not an error of the code of the bot.
What's funny is that for a moment it worked, but it didn't last more than a few minutes... Any help will be appreciated, I'm completely out of ideas!

Related

Postman API call returns 200 but the message is 'failed'

Due to system configuration issue, I had to delete the Postman and reinstall it again.
After the Postman reinstallation, I observe few api links(while other api calls are working fine) are not working.
The failed API link in the postman returns 200 but the body message as 'failed'. Although other API links works fine and receiving the message correctly.
I tried re-installing the postman but no luck. The same link was working fine before my system profile configuration issue. I understand this is something to do with my postman and system profile configuration issue but no sure what fix I apply. This API is working fine with my colleague systems.
enter image description here

AWS REST API throws CORS error when invoked from browser works in postman

I configured a REST API in API gateway. It calls a lambda function to return rows. When I tested the API in the AWS console, it works fine. When invoked from the app it throws the following error.
I copied the request as cURL command from the browser and tested from postman, and I see the response in postman. Not sure what I am missing.
Be careful about taking this error too literally. What often happens is that there is a underlying error in the API and it responded with an error message only, and thereby did not send any course headers. So it's not really a course header issue but instead some other error. Check with curl directly and see what's responding with.

Is there a workaround for Postman's bug when content is returned with a 204?

Using Postman, when I make a PUT request to an endpoint which returns a 204 with content, Postman is unable to parse the response, and my collection runner stops that iteration, indicating that an error has occurred.
When run outside of the runner, Postman displays the following:
Other people have also had this problem
Unfortunately I cannot fix the non-standard endpoint. Is there a workaround that will let Postman continue without throwing an error, especially when using the collection runner?
The 204 (204 NO CONTENT) response from the server means that the server processed your request successfully and a response is not needed.
More here: https://httpstatuses.com/204
Actually as much as I know, if the server is sending a 204 with a payload response, the endpoint is not developed as it should.
This would be the main reason Postman is not showing a response payload. You will only be able to read response headers.
So if you send a PUT request, and only receive headers, it means everything is ok. If you spect data the server should be responding with a 200 code.
Now, said this, if postman is telling you that “it could not get any response” it means basically the server is not responding any thing. Now try to increase the timeout in the postman settings. It’s very probable that the server is taking to much time. Check outside the runner how much time it’s taking to response.
I hope this helps you.

Unknown SSL protocol error in connection to graph.facebook.com:8000 FB UnitySDK

I have been trying to post some achievements in game with following code:
FB.API(FB.UserId +"/"+achievementType,
Facebook.HttpMethod.POST,
AchievementCallback,formData);
but the result is sometimes posted on my activity log and sometimes it fails to post with the message
"Unknown SSL protocol error in connection to graph.facebook.com:8000" while sometimes it is sucessful with post ID. I have tested the achievement files from facebook API explorer and also from POSTMAN plugin and it successfully posted it using both of them with post ID. But when I try to post the achievement from Unity3d it fails sometimes and works sometimes. Does anyone know what i am doing wrong while posting using UnitySDK?
Note: I have hosted these files on Github. Example AchievementFileLink
If anyone has suggestion please let me know.
The workaround I found out for this is whenever the above error happens I again send the request in the callback method to post achievement and it gets published on my game activity successfully. This should not be the intended behaviour and is very bad practice but for time being ill take this as an answer.

Boto error repeatedly appearing on Sentry server

I've configured a Sentry (https://github.com/getsentry/sentry) server to log and manage all the uncaught exceptions on my Django application, that uses Boto to send e-mail via Amazon SES. It is working well and sending e-mail alerts whenever something wrong occurs.
The problem is, almost everytime an error happens and Sentry sends me an alert, it also notifies me of another error (an exception on Boto while sending an email), but it doesn't show me what is the e-mail. I've tried all the bits of my code that send e-mail, and they are all ok. My SES config is also fine, since my application is sending e-mails to a lot of different customers daily
The error reported by Sentry is:
boto in _handle_error
<ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
<Error>
<Type>Sender</Type>
<Code>MessageRejected</Code>
<Message>Email address is not verified.</Message>
</Error>
<RequestId>4a085303-817a-11e4-b846-79819d3408ac</RequestId>
</ErrorResponse>
After this, i usually receive another error, but all it says is
boto in _handle_error
400 Bad Request
But besides all this MessageRejected warnings, when i go to my AWS Dashboard to check on SES, it shows no Rejects or Complaints, and just a really small number of Bounces (smaller than the amount of warnings i receive)
If i could at least see what email is he trying to send, it would help me debug this, but i can't find any clue about what's happening.
Boto config
The Boto section is used to specify options that control the operation
of boto itself. This section defines the following options:
debug: Controls the level of debug messages that will be printed by
the boto library. The following values are defined:
0 - no debug messages are printed
1 - basic debug messages from boto are printed
2 - all boto debugging messages plus request/response messages from httplib
Make sure you restart your Django server for the log level to take effect
The problem was the default email that Django sends to the emails on the ADMINS setting. Everytime we had an exception, it was trying to email root#localhost (the default value for ADMINS), but since this emails does not exists, it was failing to do so.