HTTP endpoints was either down or not responding - firebase

I made an action for Google Assistant using dialogue flow. When submitting the Action for production it's Getting denied.
The Webhook is on Firebase Function, the logs are empty. I re-submitted version 2 with changing the endpoint. Everything work when I test in the Simulator or my phone.
Do the Firebase function work only in particular region and not globally? If so there is no option to select the region
UPDATE
I did the deployment of Alpha as Nick suggested in the comments, It's failing in my all alpha testers too. Did I do something wrong in the configuration of the webhook or in the dialog flow code?
Here is my index.js
https://github.com/Aarth-Tandel/CountryName

Related

Unable to call Firebase function from React.js application

I have a React.js application powered by a number of Firebase functions and real time database standing behind them. It has been working without any issue for the past 2-3 months and now I am getting a warning on the functions logs which says that:
#firebase/database: FIREBASE WARNING: {"code":"app/invalid-credential","message":"Credential implementation provided to initializeApp() via the \"credential\" property failed to fetch a valid Google OAuth2 access token with the following error: \"Failed to parse access token response: Error: Server responded with status 404.\"."}
The way I initialize firebase from my React.js application looks like this:
I have double-checked everything standing behind process.env and it seems to be as expected. The website written in React.js in hosted under the Firebase hosting.
And this is how Firebase functions connect to Admin SDK:
I am not sure what would be the issue here. Nothing has changes in the code base from our side. Not sure if Firebase changed something internally that we need to consider.
What solved the issue for me was to go to the google cloud console (where Firebase functions are also available). Then I opened one of the failing cloud functions and I navigated to
My_Function_Name/Edit/RUNTIME, BUILD AND CONNECTIONS SETTINGS/RUNTIME SERVICE ACCOUNT/
And then I noticed there that for all of my functions it was selected App Engine Default Service Account instead of Firebase Admin SDK. I never explicitly set the runtime to this option. So, when I brought it back to Firebase Admin SDK the error was gone I was able to use the application once again.

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.

Firebase Remote Config & A/B Testing with real time updates

I've implemented real time remote config updates via the documentation here.
In general, it works as expected, except when it comes to experiments via A/B Testing. Changes to A/B Testing that affect remote config do not fire the update cloud function hook.
Does anyone know if its possible to have the functions.remoteConfig.onUpdate cloud function hook trigger when a change to remote config is made via an A/B Testing experiment change?
The only workaround I can think of is to have a dummy value in remote config itself that I change whenever an experiment is created/updated.
firebaser here
There is nothing built into Remote Config for that at the moment. But thanks to the integration between Cloud Functions and Remote Config, you can build it yourself.
One of our engineers actually just gave a demo for this last week. I recommend you check it out here: https://youtu.be/lIzQJC21uus?t=3351.
In this demo, there are a few steps:
You publish a change from the Remote Config console.
This change triggers Cloud Functions through a functions.remoteConfig.onUpdate event.
The Cloud Function sends an FCM message to all apps through a topic.
When an app receives this message, it shows a prompt that the configuration is out of date.
When the user clicks the "fetch" button, the app fetches the new configuration data from Remote Config.

Update a published Action on Google

Recently, I built an Action on Google and followed the official docs. I built it and pushed it for review. The google team deployed it after reviewing it as well. Now I wanted to add some new functionalities to the existing Action. However, I am faced a slight issue in doing so.
I used DialogFlow to create the agent and Firebase functions as my webhook fulfillment. Now the changes made to the agent are in draft of new version and does not affect the live version, but changing the firebase function affects my live action as the firebase function gets deployed on same URL. I also received an e-mail stating that health of my action is critical as the webhook was not replying to requests properly (As i was making some changes).
To solve this, I created another firebase function and added my all old and new functionalities to this new function and updated it as the webhook fulfillment of my same DialogFlow agent which is in draft now. After satisfactory testing, I published the same agent again and it got successfully deployed.
My question here is that, is there any other mechanism to update a published action other than creating new firebase functions ? As In alexa skill development two instance of a skills get created when a skill goes live : Live and Development. Changes in development mode (both the interaction model and backend code deployment) does not affect the live skill.
Dialogflow has a versioning and environment system which enables you to setup a "beta" track of your action with its own fulfillment while you prototype.

Fulfillment URL is not valid in Dialogflow | Using Cloud Functions

I was using Dialogflow API V1 until now and everything was working fine. It seems like the Dialogflow API V2 is now the default. I am not sure if this is the reason but I am not able to deploy cloud functions anymore.
In the fulfillment tab, it is not letting me enabled the cloud function toggle. Every time I try to enable and click deploy it gives me the following error:
Fulfillment URL is not valid
It's weird because I am not using fulfillment URL and still I am getting this error.
One workaround that worked for me when. I wanted to create a back up bot for my existing LIVE bot to use it for testing. I was getting the same issue once I restored my zip and after that try to edit the stock fulfillment.
What worked for me was, I edited the fulfillment first .index.js and package.json both after which I restored the bot using zip folder that added intents and entities to the agent. after which I was able to deploy cloud functions without getting the error.

Resources