Matija Martic
Matija Martic

Reputation: 252

Request Sync always returns 404 : "Error: Requested entity was not found."

I'm having a hard time implementing requestSync. It always returns

  "error": {
    "code": 404,
    "message": "Requested entity was not found.",
    "status": "NOT_FOUND"
  }

I use Node.js/Express for the backend. The linking/unlinking with the Google Home app work and my actions work as well. It's really the requestSync part that fails.

The closest ticket I've found, though not exactly the same, is this one.

Things I've tried

This is what the curl looks like (same as from the example)

curl -i -s -X POST -H "Content-Type: application/json" -d "{agent_us
er_id: \"1\"}" "https://homegraph.googleapis.com/v1/devices:requestSyn
c?key=API_KEY"

(my agentUserId is 1 in this case)

And this is what it looks like in code :

    const res = await fetch(
      `https://homegraph.googleapis.com/v1/devices:requestSync?key=${config.googleApiKey}`,
      {
        method: 'POST',
        body: JSON.stringify({
          agentUserId: String(userId),
          async: true,
        }),
        headers: { 'Content-Type': 'application/json' },
      },
    );

Regardless of what I do, the result is always :

  "error": {
    "code": 404,
    "message": "Requested entity was not found.",
    "status": "NOT_FOUND"
  }

I don't know where else to look to identify this problem. Any pointers would help. Thank you

Upvotes: 2

Views: 6013

Answers (1)

Matija Martic
Matija Martic

Reputation: 252

Finally found the answer.

It wasn't too far from the one I had posted above. Although my problem is that when I generated an API key, the google home cloud console opened the wrong project by default. I had the wrong API key all along.

Upvotes: 1

Related Questions