I have created a logic app to receive an http request and validate the content which is fine. But when I receive the 400 error message, it said only that it was expecting an integer but received a string for example. I would like to add the name of the field that generates the error is it possible?
postman response
I added an http response to be executed when the requst fails but it's never triggered.
logic flow
You can assign http response to a variable and then you can check which filed is causing error.
I have reproduced issue from my side and below are steps I followed,
Initially created logic app as shown below,
Payload of http trigger is,
Logic app trigger is enabled with schema validation,
I have tried to run trigger with below payload,
{
"number":1600,
"street_name":"pennsylvania",
"street_type":7
}
Got error "Failed to start a run of logic app alertschlapp. The input body for trigger 'manual' of type 'Request' did not match its schema definition. Error details: 'Invalid type. Expected String but got Integer.'."
Next modified logic app as shown below,
Added three initialize variables action for number, street_name and street_type
number:
street_name:
street_type:
Ran the logic app with below payload,
"number":1600,
"street_name":"pennsylvania",
"street_type":7
Logic app failed with below error,
In this way, you can find out which field value is causing issue.
Related
In my React app I have an axios.get request looks like the following:
axios.get('https://[app name here].firebaseio.com/shoppingCart.json')
And it returns everything from my 'shoppingCart' endpoint in Firebase Realtime Database:
If I wanted to only return records with an 'uid' of "asdf1" for example, how would I go about adding the appropriate query to my GET request, if possible?
I also tried following the documentation here https://firebase.google.com/docs/database/rest/retrieve-data (regarding filtering by a specified child key) and constructed the following request, but I'm getting a 400 bad request error.
axios.get('https://[app name here].firebaseio.com/shoppingCart.json?orderBy="uid"&equalTo="asdf1"')
Many thanks to user Frank van Puffelen for guiding me to the solution.
I made the URL call in question to the browser, and the error message I received told me that I needed to define 'uid' as my index in my Realtime Database rules for 'shoppingCart'.
After doing so, I was able to successfully receive a response from my URL call that was properly filtered by the 'uid' I passed in.
I am mocking a get request in my unittest code using requests-mock, but when I run the code during testing, it still tries to hit the actual URL instead of returning the mocked data.
This is my code:
try:
response = requests.get(api_url, auth=requests.auth.HTTPBasicAuth(username, password))
response.raise_for_status()
except requests.ConnectionError as e:
raise dke.CLIError(f"Could not connect to Artifactory server to get NPM auth information: {str(e)}")
This is my test code
class MyTest(unittest.TestCase):
#classmethod
def setUpClass(cls):
m = requests_mock.Mocker()
m.get('https://artifactory.apps.openshift-sandbox.example.com/artifactory/api/npm/auth',
text=("_auth = base64string==\n"
"always-auth = true\n"
"email = shareduser#fake.com"))
The api_url in my code matches the URL I pass to m.get(). However, when I run the test, I do not get the value of "text" but instead I get a 401 Client Error: Unauthorized and a response from the server indicating "Bad credentials" which tells me it actually tried to contact the server instead of returning the text I had requested in the Mock.
I'm lost. As far as I can tell, I'm using this exactly as the docs indicate. Any ideas?
So, it seems you can't use the request_mocker that way. It has to be a decorator or context manager.
I mean the context manager/decorator is just a pattern around normal code. I haven't tested it but i think you just have to call m.start()/m.stop().
It's generally used as a context manager or decorator because if you instantiate it once like that then your request history is going to include all requests across all unit tests which is very hard to make assertions about.
So I am trying to get an authorization token from MSFT.
I am using the HTTP Request object as an action.
I set the method to POST, provide URI, set a Content_Type in the Header, and add a grant type to the body.
Screenshot of LogicApps HTTP Setup
When I run my logic app I receive the following error:
"error": "invalid_request",
"error_description": "AADSTS900144: The request body must contain the following parameter: 'grant_type'.\r\nTrace ID: ef137edb-87d4-43e2-88b7-d119b2c00500\r\nCorrelation ID: 4ea88c05-7f28-4e3f-bb31-052c3baac198\r\nTimestamp: 2020-05-22 17:33:21Z",
"error_codes": [
900144
So the error says I am missing 'grant_type' but I have it in the body.
Can anyone point me in a direction to get this resolved?
The Body in this case is not a JSON object, it's a Form encode. Here's a screen shot where I do this same task:
You'll need to pass the client_id and client_secret as well.
I have been trying to get push notifications working using firebase. So far I have got as far as successfully sending an empty message "tickle". The problem is adding the message payload seems to have no affect on what the client receives. That is the service worker just sees it as another empty message.
I started by going through googles guide here - https://developers.google.com/web/ilt/pwa/introduction-to-push-notifications
After going through how to send an empty message it says the message payload must be encrypted and suggests using an existing library to do it. To quote - "As with anything related to encryption, it's usually easier to use an actively maintained library than to write your own code".
I tried to use web-push-php which is one of the libraries recommended by googles guide. After having trouble with that i discovered web-php-push doesn't actually support firebase.
Looking on here i find examples that look really simple and don't event encrypt the message payload. It is simply sent in plain json. Doing this has no affect and the receiving end still thinks it's an empty message. See my code below.
I am at a complete loss with this and i'm confused why googles guide says the message data must be encrypted but there are countless examples on SO where it is just send in plain json text.
This is what i am posting from my server to the end point.
POST https://fcm.googleapis.com/fcm/send Authorization: key=[my server
key] Content-Type: application/json {"priority":10,"to":"[subscriber
id]","notification":{"body":"test body","title":"test title"}}
Here is my event listener in my service-worker.js
self.addEventListener('push', function(e) {
var body;
if (e.data) {
body = e.data.text();
} else {
body = "No message "+JSON.stringify(e);
}
var options = {
body: body
};
e.waitUntil(
self.registration.showNotification('Launtel Residential', options)
);
});
When i run the post request above the push notification occurs and triggers the service worker 'push' event as expected but no message data is present. e.data returns null. The 'e' object always just contains a flag set to true. e.isTrusted==true
I have created a small BizTalk application which has a single dynamic send port with the Delivery Notification == transmitted.
The send port is configured to a folder path and when the folder is not exist it suspends the orchestration. When I try to resume the orchestration after creating the folder. I'm getting two instances in the BizTalk query expression. the instance err messages are
Status : Suspend(Not resumable)
Error code : 0xC0C01B4e (Routing Failure Report)
Routing Failure Report for "Routing Failure Report for """
Status : Suspend(resumable)
Error code : 0xc0c01b02
Error Description: The published message could not be routed because no subscribers were found.
NOTE:
I'm getting this error message only when I set the Delivery notification == transmitted
This works fine in some environment.
it might be because the pipeline define in the receive location was not set to be an XML pipeline. Change the pipeline and it should work.
There will always be 2 failure instances in case of routing failure:
First is a non resumable, information only "Routing failure report".
Second is the actual message which was not routed because no subscriber found. Hence "the published message could not be routed because no subscribers were found." This is similar to "Exception occurred when persisting state to the database." error message we see in case of Orchestration routing failures.
Now whats is the difference:
The Suspend(resumable)instance will have the message body present, and you will be able see the contents(body) of the message. However the context properties of that message won't help you finding the reason of routing failure.
However the Suspended(Not resumable) message will have the required "Context properties" which will help you determine the reason of routing failure. That's why we see following
"This service instance exists to help debug routing failures for instance "{your message instance id}". The context of the message associated with this instance contains all the promoted properties at the time of the routing failure."