Telegram bot hosted in Firebase not responding - firebase

I am developing Telegram bot with using Telegraf.js and hosting it using Firebase (as a Function).
When I run it using Firebase Function Emulators on my local everything is fine and working well. But once I deploy the function, it will only work for few minutes and after awhile (like 15+ minutes) it stops responding.
The part I not understand is that, once I create a Firebase Function that will send user a message using chat_id, it'll start responding for a few minutes.
Seems like the bot is not responding after idle for awhile, I super new with Telegram Bot, any articles or hints would really help me right now.
The code would be super basic like
bot.on(['sticker', 'photo'], (ctx) => ctx.reply('Cool! đź‘Ť'))

Reference to this issues: https://github.com/telegraf/telegraf/issues/98
I was using polling method (getUpdates) which will cause a timeout issue in Firebase server, I change to using Webhook instead.

Related

Flutter Firebase no notification shown on terminated app

I am using Firebase cloud messaging for flutter. Everything works as expected, when the app is either open or in the background. But if I close the app (terminated) no messages are received.
I send the messages with the firebase console.
I have tried two emulators, that both had play services installed.I even logged in with a google account in the emulator.
Any ideas what I might be doing wrong?
I set priority to high and it started working. The docs only talk about priority high in the context of data messages but it seems it is important for notifications as well then.

What does "Remove this app" in the Firebase console really do? ...beyond stopping the collection of analytics data

Have an old iOS & Android app that uses Firebase to authenticate & Firestore as a back end.
I just want to shut it down. i.e. stop authentication & Firestore access.
I know that's not polite but the app is causing real problems for other apps in the project.
Thought Google support: Delete Firebase App sounded promising but reading the documentation it seems like this doesn't do much more than stop the collection of analytic data - which doesn't sound like app removal at all.
Was hoping for something more dramatic but am reticent to try as removal is a one-way street.
I removed the app's OAuth clients in the Google APIs console credentials page but that didn’t have any effect on signing up, signing in ...which also seems weird.
So, would appreciate if anybody could shed more light on what removing an iOS & Android app from a Firebase project really does?
Thanks in advance
Removing the App from your Firebase project removes the credentials available to apps that may wish to log in and use your project's services, being Firestore, Realtime DB, Cloud Functions, FCM, etc . This does not disable or remove the functionality within your app client which would throw errors when the app credentials are invalid.

Firebase Emulator Cloud Functions + PubSub subscribe to production topics

There is a service that is publishing messages to my Pub/Sub. Via CLI, I know it is receiving properly the messages.
I want to react correspondingly to those messages. However, I want to develop my subscription, via Cloud Functions, in development environment (firebase emulator), so I won't have to wait 5min between each deploy. But, when using functions.pubsub.topic('topicName').onPublish(...), it won't subscribe to the real prod messages, looks like it will only subscribe to the dev env ones.
I want to, in my firebase emulated Sub/Pub, subscribe to prod messages. Is it possible to do it? How?
Still haven't found an "official" way.
What I am doing for now is use ngrok, get the local function url and then enter it in Pub/Sub Subscription in Push mode. It's a longer way and will require updating the ngrok url for each session (as its url changes in free tier), and also to get the data, JSON.parse(Buffer.from(req.body.message.data, 'base64').toString('utf-8')) and still haven't found a way to auth the JWT auth from request.
But, I can now get the Prod messages from my Firebase Emulator, as I want. You may comment here to ask for further infos about that workaround of mine.

Is it possible to run graphql subscriptions on firebase?

I want to use GraphQL subscription with Firebase cloud functions.
In my previous question I described that when I deployed my code to Firebase it threw me "Could not connect to websocket endpoint." and I couldn't even connect to it manually,but when running locally everything works like a charm.
After that I went to see if it is possible to run subscriptions with Firebase,but didn't find anything,only for queries and mutations(it works for me too).
The only post I have found is this:
https://www.reddit.com/r/graphql/comments/aijebt/graphql_on_firebase/
where someone wrote this :
"No support for GraphQL subscriptions. GraphQL subscriptions rely on a
persistent web socket connection. Since functions shutdown during
inactivity, persistent web socket connections are impossible to
support."
However I don't want to give up here,because it was 6 months ago,and he said it he tried it while it was beta,so I'm hoping it have the support now.
So my question is:
Is it possible to run subscriptions on Firebase?
If not what are your
advise to do real-time stuff on back-end with Firebase?
Thanks!
Accordingly to some posts firebase-functions has a maximum lifetime of 9 minutes,so the subscriptions won't work.

Firebase FCM InternalServerError

I implemented Firebase FCM in my app about a month ago, and it has worked great ever since, until today. When I am trying to send a push notification from my console, nothing ever shows up. I find this very strange considering it worked before I went to bed yesterday. I do also have a PHP script that sends push notifications (FCM) as well, which also was working - but when I try to use this to send a push notification, I get this:
{"multicast_id":5593178441415796544,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InternalServerError"}]}
I find this very strange. I Googled this, and I read something about re-generating my APNS certificates (because they might be wrong or something), which I thought was weird as well, due to the fact that I created new certificates yesterday as well (which was working). Now I have once again tried to delete, and generate new - without any luck.
I also want to point out that when I go to my 'Cloud messaging' tab in Firebase, to configure my certificates, I am unable to delete - only re-upload.
What could this possibly be? I have checked my certificates and my API key is correct. It was working 100% 10 hours ago.
Could this be a Firebase problem, or how would I solve this? Help is much appreciated.
Most of the InternalServerError returned by FCM before February 2017,
were due to issues with the APNs certificates.
The API has now been updated.
Now if there an issue with the APNs certificate,
FCM will return error:InvalidApnsCredential

Resources