aws iot rule fails with message "Error while evaluating operator '=': Undefined result" - aws-iot

I created an AWS IOT Rule with the following SQL:
SELECT * FROM 'colors' WHERE color = 'green'
Then I use the "Test Tool" in the IoT console to publish the following message to the 'colors' topic:
{
"default": "{\"color\":\"green\",\"temperature\":100}"
}
The rule does not trigger the configured action, that would be sending the message to a SNS topic.
On cloudwatch logs I see the following error message:
[ERROR] EVENT:WhereEval TOPICNAME:colors CLIENTID:iotconsole-1554220753724-0 MESSAGE:Error while evaluating where clause: Undefined result
What am I missing? The AWS IoT SQL documentation defines the '=' operator.

Ok I found my mistake. The SQL syntax wasn't wrong, what was wrong was the message. I had to change the message to:
{
"default": "{\"color\":\"green\",\"temperature\":200}",
"color": "green"
}
Now the SQL was able to find the 'color' property.
The action to publish on the SNS topic was accomplished and I received the unescaped JSON that was written in the 'message' field:
{"color":"green","temperature":200}

Related

Access package assignment approval update via MSGraph API returns HTTP 403: Only user tokens are supported

I'm trying to call Access package assignment approval update via MSGraph Beta API (Java 0.51.0-SNAPSHOT). The call fails with following error:
2022-08-26 22:32:44.239 ERROR 10208 --- [nio-9999-exec-4] global : CoreHttpProvider[sendRequestInternal] - 408Graph service exception
2022-08-26 22:32:44.239 ERROR 10208 --- [nio-9999-exec-4] global : Throwable detail: com.microsoft.graph.http.GraphServiceException: Error code:
Error message: Only user tokens are supported
PATCH https://graph.microsoft.com/beta/identityGovernance/entitlementManagement/accessPackageAssignmentApprovals/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/steps/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb
SdkVersion : graph-java/v0.51.0
[...]
403 : Forbidden
[...]
[Some information was truncated for brevity, enable debug logging for more details]
Based on the error message can I think, that Application tokens are not really supported, but the strange thing is, that I can call Access package assignment approval get without any issue. I have of course delegated the permission EntitlementManagement.ReadWrite.All to the Application user.
I tried to reproduce the same in my environment using Graph Explorer and got the below results:
I am able to retrieve the properties of an approval object successfully like this:
GET https://graph.microsoft.com/beta/identityGovernance/entitlementManagement/accessPackageAssignmentApprovals/<id>
Response:
To update those properties, I ran the same query as you like below, and it got updated successfully:
PATCH https://graph.microsoft.com/beta/identityGovernance/entitlementManagement/accessPackageAssignmentApprovals/<id>/steps/<id>
{
"reviewResult": "Approve",
"justification": "Please approve"
}
Response:
Make sure to pass 'Request body' with the PATCH query. Please check whether you are giving correct id's or not in the query.
The <id> before /steps/ in the query is the id of accessPackageAssignmentRequest that is in PendingApproval State.
To get that id, you can run the below query:
GET https://graph.microsoft.com/beta/identityGovernance/entitlementManagement/accessPackageAssignmentRequests?$expand=requestor($expand=connectedOrganization)&$filter=(requestState eq 'PendingApproval')
Response:
The <id> after /steps/ in the query is the step id that I got by running below query:
GET https://graph.microsoft.com/beta/identityGovernance/entitlementManagement/accessPackageAssignmentApprovals/<id_that_you _got_in_above_query>
Response:
UPDATE
Please note that, you cannot update Access package assignment approval using Application permissions. Application permissions are not supported for PATCH query.
You can refer this MsDoc to confirm that like below:
So, it will only work if you login with work or school account(personal-login)

Logic App not able to deserialized Azure data factory pipeline error message

I am facing the below issue with Azure Data Factory using Logic App.
I am using the Azure Data Factory pipeline for migration and Logic App for sending "Success & Failure" notification to the technical team.
Now success is working fine as the message is hardcoded, but failure is not as the Logic App web activity is not able to parse data factory pipeline error.
Here is the input that is going to Logic App web activity
Input
{
"url": "https://xxxxxxxxxxxxxxxxx",
"method": "POST",
"headers": {},
"body": "{\n \"title\": \"PIPELINE RUN FAILED\",\n \"message\":\"Operation on target Migration Validation failed: Execution fail against sql server. Sql error number: 50000. Error Message: The DELETE statement conflicted with the REFERENCE constraint \"FK_cmclientapprovedproducts_cmlinkclientchannel\". The conflict occurred in database \"Core7\", table \"dbo.cmClientApprovedProducts\", column 'linkclientchannelid'.\",\n \"color\": \"Red\",\n \"dataFactoryName\": \"LFC-TO-MCP-ADF\",\n \"pipelineName\": \"LFC TO MCP MIGRATION\",\n \"pipelineRunId\": \"f4f84365-58f0-4da1-aa00-64c3a4daa9e1\",\n \"time\": \"2020-07-31T22:44:01.6477435Z\"\n}"
}
Here is the error logic app is throwing
failures
{
"errorCode": "2108",
"message": "{\"error\":{\"code\":\"InvalidRequestContent\",\"message\":\"The request content is not valid and could not be deserialized: 'After parsing a value an unexpected character was encountered: F. Path 'message', line 3, position 202.'.\"}}",
"failureType": "UserError",
"target": "Send Failed Notification",
"details": []
}
I have tried various options, like set variable and convert by using various existing methods (string, json, replace etc), but no luck
e.g #string(activity('LOS migration').Error.Message)
Struggling almost all day this...please suggest if anyone faced a similar issue...
Below is the data flow activity
now it is working...
Pasting body content into the body text field box WITHOUT clicking on 'Add Dynamic Content' in web activity calling Logic App.
For the failure case, pass the error output use #{activity('LOS migration').error.message.
For sending email, it doesn't know if it's going to send a failure or success email. We have to adapt the body so the activity can use parameters, which we'll define later:
{
"DataFactoryName": "#{pipeline().DataFactory}",
"PipelineName": "#{pipeline().Pipeline}",
"Subject": "#{pipeline().parameters.Subject}",
"ErrorMessage": "#{pipeline().parameters.ErrorMessage}",
"EmailTo": "#pipeline().parameters.EmailTo"
}
We can reference this variables in the body by using the following format: #pipeline().parameters.parametername. For more details, you could refer to this article.
If you want to use the direct error message of the data factory activity as an input to the logic app email expression, you could try.
"ErrorMessage": "#{string(replace(activity('activity_name').Error.Message, '"',''''))}"
Replace 'activity_name' with your failing activity name.

Positive Scenario Usage of StatusReport google home trait

In Google documentation, they explained how to use "statusReport" trait for query intent when there is an error or exception occurred for a device. I'm facing issue while using it for success status without any exception. I tried sending the response with simple status as SUCCESS, Google Home is saying the response "Sorry Unable to reach device".
The response which I was sending:
{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "devices": { "123": { "online": true, "status": "SUCCESS" } } } }
can anyone help me to solve this issue?
After looking at the code, it is clear that you’re not sending the correct & complete response of the StatusReport trait. Your response contains the online attribute but missing the currentStatusReport attribute (it is required as it defines the current error statuses of the associated device IDs). For more information, visit https://developers.google.com/assistant/smarthome/traits/statusreport?hl=en

Encounter issue installing of Sitecore XP0. The declared parameter 'Search SOLR Core Application Connection String' is not recognized

I installed Sitecore 9.0.2 XP Single Topology PAAS. Unfortunately, the installation is not successful because it looks like the ConnectionString I specified is not valid.
{
"code": "DeploymentFailed",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.",
"details": [
{
"code": "Conflict",
"message": "{\r\n \"status\": \"Failed\",\r\n \"error\": {\r\n \"code\": \"ResourceDeploymentFailure\",\r\n \"message\": \"The resource operation completed with terminal provisioning state 'Failed'.\",\r\n \"details\": [\r\n {\r\n \"code\": \"DeploymentFailed\",\r\n \"message\": \"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.\",\r\n \"details\": [\r\n {\r\n \"code\": \"Conflict\",\r\n \"message\": \"{\\r\\n \\\"status\\\": \\\"Failed\\\",\\r\\n \\\"error\\\": {\\r\\n \\\"code\\\": \\\"ResourceDeploymentFailure\\\",\\r\\n \\\"message\\\": \\\"The resource operation completed with terminal provisioning state 'Failed'.\\\",\\r\\n \\\"details\\\": [\\r\\n {\\r\\n \\\"code\\\": \\\"DeploymentFailed\\\",\\r\\n \\\"message\\\": \\\"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.\\\",\\r\\n \\\"details\\\": [\\r\\n {\\r\\n \\\"code\\\": \\\"Conflict\\\",\\r\\n \\\"message\\\": \\\"{\\\\r\\\\n \\\\\\\"status\\\\\\\": \\\\\\\"failed\\\\\\\",\\\\r\\\\n \\\\\\\"error\\\\\\\": {\\\\r\\\\n \\\\\\\"code\\\\\\\": \\\\\\\"ResourceDeploymentFailure\\\\\\\",\\\\r\\\\n \\\\\\\"message\\\\\\\": \\\\\\\"The resource operation completed with terminal provisioning state 'failed'.\\\\\\\",\\\\r\\\\n \\\\\\\"details\\\\\\\": [\\\\r\\\\n {\\\\r\\\\n \\\\\\\"code\\\\\\\": \\\\\\\"Failed\\\\\\\",\\\\r\\\\n \\\\\\\"message\\\\\\\": \\\\\\\"AppGallery Deploy Failed: 'Microsoft.Web.Deployment.DeploymentXmlException: The declared parameter 'Search SOLR Core Application Connection String' is not recognized.\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n at Microsoft.Web.Deployment.DeploymentSyncParameterCollection.LoadFromFile(XPathNavigator nav, String fileName, Boolean ignoreExtraSetParameters)\\\\\\\\r\\\\\\\\n at Microsoft.Web.Deployment.WebApi.AppGalleryPackage.LoadSetParameters(DeploymentObject deploymentObject, IDictionary`2 setParams, String setParamXmlFile)\\\\\\\\r\\\\\\\\n at Microsoft.Web.Deployment.WebApi.AppGalleryPackage.Deploy(String deploymentSite, String siteSlotId, Boolean doNotDelete)\\\\\\\\r\\\\\\\\n at Microsoft.Web.Deployment.WebApi.DeploymentController.<DownloadAndDeployPackage>d__17.MoveNext()'\\\\\\\"\\\\r\\\\n }\\\\r\\\\n ]\\\\r\\\\n }\\\\r\\\\n}\\\"\\r\\n }\\r\\n ]\\r\\n }\\r\\n ]\\r\\n }\\r\\n}\"\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n}"
}
]
}
Here is the parameter I specified in the template:
},
"solrConnectionString": {
"value": "http://avanade-smart-solr-paas.azurewebsites.net/solr"
},
What am I missing?
For Sitecore it is required that SOLR runs on https,
so you need first fix a ssl certificate and supply a working https url.
Are you running SOLR on app services?, a experimental environment. but with a built-in SSL certificate. See this blog for how to install this https://getfishtank.ca/blog/installing-solr-app-service-in-sitecore-azure-paas

Better error message when missing required fields from request

When missing a required field currently ProtoRPC returns a message like this:
{
"error": {
"code": 400,
"errors": [
{
"domain": "global",
"message": "Error parsing ProtoRPC request (Unable to parse request content: Message CombinedContainer is missing required field api_key)",
"reason": "badRequest"
}
],
"message": "Error parsing ProtoRPC request (Unable to parse request content: Message CombinedContainer is missing required field api_key)"
}
}
Is it possible to provide a better error message? Ideally, "missing required field api_key" in this example.
According to the Google Code Issue Tracker and Github issues this was once being worked on. However, there does not appear to be any activity.
I'd greatly appreciate any solutions or workarounds.
As of today, the ProtoRPC still returns the same unraised error which makes it harder for one to return a customized error response.
A simple workaround is to make the Message fields optional and enforce the requirement constraint somewhere in the endpoint handler/method.
So instead of;
class Request(Message):
name = StringField(1, required=True)
Set 'name' as optional,
class Request(Message):
name = StringField(1)
The requirement constraint can then be enforced in the endpoint handler method by simple if statements OR by mapping these fields to a Datastore entity that requires these fields, hence will allow exception handling of BadValueError and return a more customized error response.
Example:
try:
account = Account(name=request.name)
account.put()
except BadValueError:
return Response(status=False, message='Missing field "name"')

Resources