KrakenD returns a 500 when the body of the backend endpoint doesnt have any data - go

I am using KrakenD to make a call to a Salesforce endpoint
/services/data/v56/jobs/ingest/{{_jobId}}/batches
This backend endpoint doesn't return any data in the response body and as a result the call fails with a 500. From the logs -
[00] [KRAKEND] 2023/01/27 - 23:39:45.615 ▶ ERROR [ENDPOINT: /ingest/:jobId/batches] EOF
How do I solve this error? How can I tell KrakenD to expect the empty response body?
I am not using any custom plugins.

You should check the encoding defined at the backend section (by default, it's JSON) and select one that suits your backend responses. Here you'll find some recommendations: https://www.krakend.io/docs/backends/supported-encodings/#how-to-choose-the-backend-encoding
If you are expecting empty responses, you could use no-op (https://www.krakend.io/docs/endpoints/no-op/)

Related

JMeter - Getting 400 Bad Request

In JMeter - I am getting 400 bad request.
I have validated the JSON format, JSON request is correct. But showing error in Request body as
Error: "Cannot assign " ": "Address.created_by" must be a "User" instance."
In Header manager- I have included all the correct Content-Type and other headers as well.
Could you please provide a solution for this error?
This is due server side validation failing and server returning 400 - Bad Request. Please check the same request object in Postman or SoapUI
JSON request might be correct but JSON request body seems to be incorrect, cross check your request body with API specification documentation i.e. Swagger UI it might be the case that API contract has changed and your test is sending the request in the "old" format.
Also Taurus framework has a special tool for converting Swagger API definitions into Taurus YAML files which in their turn can be converted into JMeter .jmx scripts

Azure Logic App - Get Response Body with 500 Internal Server Error

Is there any way to get the response body in Azure Logic App even when we get 500 Internal Server Error?
I have made the Logic App in a way that I'm setting the response code to 500 on an issue, and I'm adding some error related information in the response body. I tried returning 504 Gateway timeout as well, in case of a timeout issue I could face, but I'm always receiving a null response body in case of non-200 response codes.
If we are not able to see the response body in case of an error by design, is there a better way to set and fetch error related information from the response object?
Yes you can get the response body in Azure Logic App by adding the response action. According to this Add a Response action section of the Microsoft document.
When you use the Request trigger to handle inbound requests, you can model the response and send the payload results back to the caller by using the built-in Response action.
Following steps would help you to get the response body.
In the Logic App Designer, under the step where you want to add a Response action, select New step.
The under Choose an action, in the search box, enter response as your filter, and select the Response action.
Now add any values that are required for the response message. For the Body, you can select the trigger body output from the dynamic content list.
I would suggest to read the Receive and respond to inbound HTTPS requests in Azure Logic Apps document for more information.
Alternatively you can also create alerts whenever HTTP 500 errors occur in your App and use Application Insights to view it using Azure Monitor. I would also suggest to read this Handle errors and exceptions in Azure Logic Apps Microsoft document for more information.

Is there any tool to debug the rest calls made by GraphQL Playground?

I'm not able to figure out why the REST API call works just fine in Postman but not in the GraphQL Playground. If I could see the actual REST call being made by GraphQL, would be helpful to debug the issue.
Firecamp's GraphQL client lets you test the GraphQL as an API call or as a Query way.
Here is the dedicated GraphQL client
Here is REST like GraphQL client
Note: Make sure that you double-check the method and headers while using REST-like GraphQL client. IN most cases method would be post and header should contains Content-Type: application-json / application/graphql
The GraphQL playground allows to send GraphQL queries/mutations to your GraphQL server. You can see the requests that are send using the network tab of a browser dev tools.
For example, if a server is in running at the following address http://localhost:4000/graphql, sending a query/mutation, a XHR request will be sent to it. In the Request Payload of the Headers section there is the query/mutation itself.
In the Response section you can see the returned response.
You can start having a look at the returned response of your query/mutation. Perhaps there is something wrong in the related resolve function in GraphQL.

Jmeter Response 500 internal server error for request

HI everyone I need a help regarding to fix the 500 internal server error
Please check my below attached requests and correlation and response image
Please tell me if I was wrong in anywhere I keep trying to do the scripts to run and the result was 500 error.
Redirect request:
Https request1:
Data correlation:
Passing parameters:
Sending request details:
Response message:
Looking into Content-Type header of your request it appears that you should be sending a JSON while you're sending parameters in form of name-value pairs
I think you should switch to Body Data tab in the HTTP Request sampler and put your parameters there like:
Also double check your API contract, it might be the case you need to change the method to POST
More information: REST API Testing - How to Do it Right

POST call in Mulesoft

I am trying to make a HTTPS POST call in mulesoft to an external API. I had read in the mulesoft documentation and also in other posts that in order to send the request body, a map has to be prepared.
Hence, i am using the "Set-Payload" to prepare a map.
Eg: #[{'key':'value'}]
When I am using the logger to display it, it prints a map (as expected).
But when the POST call is being made, i am receiving the following error:
Response code 503 mapped as failure. Message payload is of type: BufferInputStream
Payload : org.glassfish.grizzly.utils.BufferInputStream#3f8f77a
Could anyone let me know where am i going wrong?
Thanks in Advance.
The server you're trying to call is returning status 503. Have you tried calling the external API using other client SOAP/Postman/Curl?
Also check this out:
http://forums.mulesoft.com/questions/2009/consume-get-restful-service.html
You should set proper mimetype for muleMessage and set the http POST method, then it should work.
While posting the data male sure how your http is expecting the input. What ever the transformations you want to make before posting do it, finally when posting the data to http cross check your data type with the data in the server your are trying to send. Both needs to match. Then it work.
I generally try to Isolate HTTP interaction problems into two parts. One is related to request itself for e.g. URL,Method,Headers,Payload,MimeType and other should be related to transport and network interaction with Server itself. To better view the information for both of the above details use a htt[ proxy/debugger [for. e.g. Fiddler] around the traffic flowing while you make a request. This will throw more light on the stuff hindering you while making this call successfully.
You can try any of the below sugestions-:
Set payload as map, mention MIME Type as application/json and then use json to object transformer (with return class as java.util.HashMap).
Set payload as simple string. This could help.
Status code 503 implies that the server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay.
Please try resending the message or hit the API with Postman.
It looks like you need to change the port in the request-config to 443 since you're using HTTPS.
<http:request-config name="HTTP_Request_Configuration" protocol="HTTPS" host="jiratst.murex.com" port="443" doc:name="HTTP Request Configuration" basePath="/rest/api/2/project">
try using input {'key':'value'} in set payload instead of Array.

Resources