Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Getting error as response when broadcasting a message #7

Closed
chrisjenx opened this issue Jun 9, 2022 · 12 comments
Closed

Getting error as response when broadcasting a message #7

chrisjenx opened this issue Jun 9, 2022 · 12 comments
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@chrisjenx
Copy link

Hey thanks for putting this together, unforutnatly after getting the token and client_secrete when sending curl commands to the docker container all I get is error outputs:

Checked Google API console, no requests ever hit it, so looks like an issue before it even gets that far, fyi I'm running docker on x86 machines, not sure if that makes a difference considering it's node?

image

@chrisjenx
Copy link
Author

I was trying to run the server locally to debug but node dosn't want to play ball, I think I got node to work once in my life:

{"error":{"code":"MODULE_NOT_FOUND","requireStack":["/Users/chrisjenkins/git/google-assistant-broadcast/node_modules/google-assistant/components/auth.js","/Users/chrisjenkins/git/google-assistant-broadcast/node_modules/google-assistant/index.js","/Users/chrisjenkins/git/google-assistant-broadcast/assistant.js","/Users/chrisjenkins/git/google-assistant-broadcast/index.js"]}}%

Followed all google steps for cleaning/reinstall 🤷

@ismarslomic
Copy link
Owner

The error handling and error messages are currently not quite useful. Will take a look at it!

However, what node is trying to tell you is that it fails importing client secret and tokens file.

You can set path to these two files by starting node with env vars mentioned in line 8 and 12 in assistant.js

@chrisjenx
Copy link
Author

chrisjenx commented Jun 9, 2022 via email

@chrisjenx
Copy link
Author

OK got it working locally, without a better error in the docker container not sure where to go there. However this got me thinking about https://developers.google.com/assistant/smarthome/develop/notifications#java
I might throw something together to see if works how I think it should

@ismarslomic
Copy link
Owner

You started index.js in Node locally and then it worked?

@chrisjenx
Copy link
Author

Yeah works locally (I just set the tokens and client secret with full path from root and it worked).

Still no luck on docker, files are readable and accessable inside the docker container and the error is just blank as above. Not sure if theres any better error logging to be had?

@ismarslomic
Copy link
Owner

I did release new version 1.0.5 of Docker image today. I added validation of required files, checking if they exist. You could give it a try? I dont get why Docker should introduce any issues here..

@chrisjenx
Copy link
Author

Just updated, started up fine, same issue.. no error in logs too, super weird..

➜ ~ curl -X POST http://10.10.106.2:8085/broadcast
-d '{"message":"Hello world!!"}'
-H "Content-Type: application/json"
{"error":{}}%

@ismarslomic
Copy link
Owner

ismarslomic commented Jun 9, 2022

While doing some testing few minutes ago, I experienced same issue on my side. Everything looked correct, but response where empty error. And I managed to fix it 🥳 .

Issue where that I downloaded the OAuth 2.0 credential file for my registered device from the Google Actions Console and used that to generate the OAuth Token (with use of google-assistant-oauth docker container). When I tried to use the client_secret.json and tokens.json, I received error as response.

google-actions-console

But, when I used the OAuth client file, downloaded from the Google Cloud Platform console, then it worked.

gcp-console

I looked at the content of these two files and the main difference where on two places:

OAuth 2.0 credential file:

{
  ...
  "token_uri": "https://accounts.google.com/o/oauth2/token"
}

OAuth client file:

{
  ...
  "token_uri": "https://oauth2.googleapis.com/token",
  "redirect_uris": [
      "http://localhost"
  ]
}

So you could check which of these files you are using, and try to download the one from GCP Console.

@chrisjenx
Copy link
Author

Yup that missing "token_uri": "https://accounts.google.com/o/oauth2/token" fixed it for me instantly, interesting!

Not sure why running locally worked with the files missing those...

@ismarslomic
Copy link
Owner

Nice! Happy to see that you are finally up and running with google-assistant-broadcast docker container!

I have added new validation steps in both docker images, so new folks can easily identify this issue. Thanks for reporting this issue!

Can we close this issue now?

@ismarslomic ismarslomic changed the title Just get "error" Getting error as response when broadcasting a message Jun 9, 2022
@ismarslomic ismarslomic self-assigned this Jun 9, 2022
@ismarslomic ismarslomic added enhancement New feature or request question Further information is requested labels Jun 9, 2022
@chrisjenx
Copy link
Author

Yes thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants