Twig\\Error\\RuntimeError status 500 mailjet API - ajax

In a symfony project,
I use an API mailjet to send emails,
In case of sending lots of email (over 290 emails), I have this error.
Status Code: 500 Internal Server Error
Runtime exception
Thanks!
After a search, I found that the error is due to a limit of the post request.
In fact I used ajax to send an array of 400 itemsin the data, but ajax is limited to 294 items.
Do you have a solution to increase this limit?

Related

What's the http status code if a site key exceeds 1000 QPS for recaptcha?

in recaptcha document, it says that if a site key exceeds 1000 QPS, then some requests may not be processed, I am wondering how I can identify this error if this happens? I assume a http code of 429 is thrown by google server?
The reCAPTCHA-specific quota page links to a more general Google API quota page that says
If you exceeded a quota with an HTTP/REST request, Google Cloud returns an HTTP 429 TOO MANY REQUESTS status code.
If you exceed a quota with an API request, Google Cloud returns an HTTP 413 REQUEST ENTITY TOO LARGE status code.
If you exceeded a quota using gRPC, Google Cloud returns a ResourceExhausted error. How this error appears to you depends on the service.
If you exceeded a quota using a Google Cloud CLI command, the gcloud CLI outputs a quota-exceeded error message and returns with the exit code 1.
Since you mention HTTP, I imagine you're in one of the first two categories. If you're going through their REST interface, you'll get 429. If you're going through the API, you'll get 413.

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.

Map AWS Lambda 429 errors to API Gateway 2XX response

I understand that by design, API Gateway maps 429 errors from Lambda to 500 responses.
Is there a way to map 429 to something else like 202?
I tried to create an integration response mapping from this regex: .*
which should map virtually everything to my defined status code, but i still receive 500 errors, from the API gateway.
Pasting my response from the AWS Forum post:
There is no way to map Lambda's 429 to any status code. It will always
be considered as 500. Curious to know, why do you want to map 429 to
202 (which means 'Accepted')?
Lambda 429 now maps to the INTEGRATION_FAILURE API Gateway response, so you can map it to any code you want, but keep in mind that will make any other integration error return that code as well. See https://forums.aws.amazon.com/thread.jspa?threadID=309901

What should be the Http Server code for Validation Error happening in server?

When an action is called by the client to server say POST/PUT, there would be some validations happening in the data that needs to be processed. But that data doesn't comes as a request, data would be fetched from DB (coz the endpoint clearly knows what it should do, so I dont tell the service what to update) and on top of that, validations would be performed.
So if any validation fails on such data, what should be the response code that should be returned?
Am sceptical to use 4XX codes, since those codes are reserved for the errors produced by client.
In my case, since client does not produce any error, what should be the response code for these kind of validation errors?
If your service returns an error which is definetly not caused by the user's request data rather than from the data/state of the server, the service should respond with HTTP 500 Internal Server Error. There is no specific Internal Server Validation Error status code in RFC2616/RFC7231, so I recommend to take the 'general' 500 status.
From RFC 7231:
The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

Getting 400 Bad request error when sending huge amont of data with post

I am using yahoo YUI Ajax call to post request.
Page is developed in JSP and server is Tomcat 6 and using Struts 2.x.
While i am sending small amount of data using Ajax call post request it is working fine.But when i am sending huge amount of data i am getting 400 bad request error.
The 400 error comes when The Web server thinks that the data stream sent by the client (e.g. your Web browser ) was 'malformed' i.e. did not respect the HTTP protocol completely. So the Web server was unable to understand the request and process it.
There could be possibilities that data is too large, so you should better encode the data using java script inbuilt function for example escape().
Please check maxPostSize attribute of Connector in conf/server.xml.
See the following doc for the details
In Tomcat, when the post data exceeds the maximum specified in maxPostSize (server.xml) it returns a 400 as error code

Resources