Skip to content

google-home/smart-home-error-reporting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart home error reporting utility

This sample shows how to integrate Stackdriver with your smart home service in order to process and triage errors that originate when your service sends an invalid response to the Google Assistant.

In this sample, you are able to simulate many common errors that may be in a smart home response. You can view these errors in graphs and reports.

Setup

Setup project

  1. Follow the instructions to set up and initialize the Firebase SDK
    • Setup Cloud Functions, Hosting, and Firestore

Setup sample code

  1. cd functions && yarn && cd ..
  2. cd public && yarn
  3. yarn firebase-setup
  4. yarn build
  5. Run firebase deploy and take note of the hosting URL. It should look like: <project-id>.firebaseapp.com

Domain Verification

  1. Open the Google Cloud Console and go to APIs & Services

    1. Under Credentials > Domain Verification add your domain.
    2. After adding your domain you will be taken to the Google Search console. Follow the instructions there to finish verifying your website before proceeding.
    3. You will download a verification webpage. Add this file to the public directory.
  2. Run firebase deploy to upload this new verification file

Google Cloud Pub/Sub

To start exporting your errors, go to Logging > Logs

  1. Create a new Export
    1. Give it a name like smarthome-error
    2. Select Cloud Pub/Sub as the Sink Service
    3. Create a new Cloud Pub/Sub topic
  2. Go to Logging > Exports, find the export you just created, and select Edit sink
    1. Update the filter for your service to be:
severity>=ERROR
("SYNC")
  1. Click Update Sink and replace your existing sink.
  2. Go to Pub/Sub > Topics
    1. You'll see your topic has already been created.
    2. Select your topic and create a new subscription
    3. Give your subscription a name
    4. Choose the Push delivery type and enter the endpoint: <project-id>.firebaseapp.com/alerts/stackdriver
    5. Select Save

Now you are ready to triage errors to your server.

  1. Open <project-id>.firebaseapp.com in a web browser
    1. You can use the dropdowns to change the validity of certain parameters
    2. You can use the SYNC button to generate invalid responses
    3. You'll see these errors get displayed on the page
    4. Your function will also be executed with the error from Stackdriver
    5. The Firestore instance will be updated, and you'll see the graphs change

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published