Google Smart Home action responds "[Service] is not available right now" after the action completed succesfully - actions-on-google

My Google SmartHome action is giving an error message "[Service] cannot be reached right now" after having executed the command properly. My device is properly switched on / off, but Google ends with that annoying message.
The input I get from Google:
{"inputs":[{"context":{"locale_country":"NL","locale_language":"nl"},"intent":"action.devices.EXECUTE","payload":{"commands":[{"devices":[{"id":"6"}],"execution":[{"command":"action.devices.commands.OnOff","params":{"on":true}}]}]}}],"requestId":"1389468583286354563"}
The response I give back:
{"requestId":"1389468583286354563","payload":{"commands":[{"ids":["6"],"status":"SUCCESS","states":{"on":true,"online":true}}]}}
Function execution took 2287 ms, finished with status code: 200
Next, I already (async) report state:
{"requestId":"1389468583286354563","agentUserId":"f0524769-7ffb-4ae4-8cec-5d67e6f6aa92","payload":{"devices":{"states":{"6":{"on":true,"online":true}}}}}
The report state API gives back that that was successfull.
I have no clue why Google gets back (even though the action is carried out successfully) that they cannot reach our service?

Thanks to #Devunwired: I overlooked the Google Assistant Action logs. In it, it said the function is returning an empty JSON response. It turned out that the return statement was 1 parenthesis too early, causing the async function to return an empty value.

Related

Google actions fails to read error response and end the session smoothly

I have an actions project built and working. I'm trying to handle some error scenarios where it is failing. I need some help there.
I have a scenario where the webhook call throws a proper JSON formatted error response as shown below but which couldn't not be read at google end. Not sure if that is google actions limitation. Because of this issue I couldn't trigger a webhook handler back to my server to end the open conversation smoothly.
{
“responseJson”: {
“error”: {
“message”: “Transaction cancelled: maximum execution time exceeded”,
“detail”: “Transaction cancelled: ****”
},
“status”: “failure”
}
}
In the Error & status handling of actions scenes I dont see any system intent other than Cancel to handle any such error scenarios, I don't see any other relevant system intents too.
In simple words, I'm trying to catch a bad response and trigger back a webhook call to end the conversation at server side.
Could someone suggest a way to deal with this issue?

Google Home not getting a valid assistant response when executing actions for bulbs

I have integrated google assistant into my own app. When executing an action for a LIGHT device type, such as turning it on/off, I get an assistant response like "OK, Sorry, I can't reach the Bulb right now. Please try again" but the execution happens anyway. Following is a sample response which will send in response to an execute intent request.
{"payload":{"commands":[{"ids":[12549],"status":"SUCCESS","states":{"online":true,"on":true}}]},"requestId":"15838577278862147328"}
What am I doing wrong here? this works perfectly for other device types (OUTLET, SWITCH).
Also I can use the home app ui for bulb to control it manually and it works perfectly.
The bulb I'm using is a TuyaSmart rgb light bulb.
Looking at the response, it appears that the identifier 12549 is a number and not a string. The platform expects a device ID to be a string. By putting it in quotes it will work.

PayPal Sandbox Blank Address Error

I just recently started working with the PayPal API to start processing credit cards for a client and have run into an odd issue. I managed to get everything mostly working (the 400 Bad Request error that is all over SO is still outstanding for me) minus one thing. When I try to run a CC against the sandbox area with nothing specified for line 2 of the address I see the following error get logged:
Error Response: {"name":"VALIDATION_ERROR","details":[{"field":"payer.funding_instruments[0].credit_card.billing_address.line2","issue":"Must not be blank"}],"message":"Invalid request - see details","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#VALIDATION_ERROR","debug_id":"cbaa2c4dfdb77"}
Why would address 2 be required? Their own documentation (https://developer.paypal.com/webapps/developer/docs/api/) says it isn't so I'm completely lost here.
This is using the RestAPISDK library downloaded from their GitHub instance and everything I'm doing is in C#.
When you have a blank value in a REST API call it will return an error. It isn't required to provide a line2 value but if you include the variable with a blank value the system will flip out. Remove the variable entirely and you should be good to go.

Credits: Error occurs *sometimes*

I created a Facebook app and integrated Credits. However, about every second time I call the credits API, I get the following error:
There Was a Problem Processing Your Payment / Sorry, but we're having trouble processing your payment. You have not been charged for this transaction. Please try again later.
Everything on my end looks good. On success, the callback is called 3 times:
payments_get_items
payments_status_update, status "placed"
payments_status_update, status "settled"
When it fails and the above error dialog is shown, I can see that only the first call is performed (payments_get_items).
I can see that the response back to Facebook is the same in both cases:
{ "content":[ { "item_id":"1", "title":"[title]", "description":"[description]", "image_url":"[url]", "product_url":"[url]", "price":30 } ], "method":"payments_get_items" }
Has anyone experienced this or can imagine what the reason for the behaviour is?
Thank you!
Bw
I just had similar issue.
Error message is generic and it doesn't give you exact cause of the problem.
In my case the problem was that my image url was misspelled so check your payments_get_items response very carefully.
Beside checking image url validity also check that length of your title and description is ok.
check "Developers response" section on this url for info on boundaries :
https://developers.facebook.com/docs/payments/callback/#payments_get_items
BTW, I think they mistakenly marked product url as required, however you can put same value as for image url just to be sure.

Credits callback script not called (error 1383046)

I have a problem getting facebook to call my credits callback script. I've setup a company and the callback url. I used the example script for it. But nonetheless I always get this error when I try to access the payment window using the JS sdk.
var obj = {
method: 'pay',
order_info: order_info,
purchase_type: 'item'
// dev_purchase_params: {'oscif': true}
};
FB.ui(obj, getCashCB);
Error:
There Was a Problem Processing Your Payment
Sorry, but we're having trouble processing your payment. You have not been charged for this transaction. Please try again.
error code from console: 1383046
meaning:
1383046 AppInvalidDecodedResponse The application return value was invalid after json_decoding the return value.
No matter if I'm in sandbox mode, set the callback url to something completely different.
The callback script is never called.
I've searched far and long for anybody else with this problem, but found nothing meaningful. There was something about the server accepting curl requests from facebook but I don't know what that means or how to test for it.
Solved! Whilst looking for the cause I noticed that this error can pop up from a lot of things. But this case is rather specific:
Because the facebook app is still in development, we hid it behind a .htaccess file. So when you visit the site, you login, and the app loads etc. BUT this doesn't work for the credits callback file. Since the request then comes from facebook, it would have to login with user:pass. I tried putting that in the callback URL, but that doesn't seem to work.
So I only need to put the callback file somewhere where you can reach it without .htaccess and Tadaaa it works!
Basically this happens when Facebook doesn't understand the response it gets from calling your payment callback URL. Thew most likely reasons are:
The callback URL is wrong
Facebook gets an error response because the server or some app-level firewall won't let it access the URL (Jon's problem)
Facebook gets an error response because the callback script runs into an exception.
The callback script's response is malformed.