Create order failed

sometimes, request to the the square api create order failed, and ApiException.getErrors() is null. if you can tell me the reason, it’s better. below is the log, maybe it could help your enginner to improve.

00:05.774637438 ERROR c.f.i.log.LogManager - [java.lang.NullPointerException] Cannot invoke “java.util.List.get(int)” because the return value of “com.squareup.square.exceptions.ApiException.getErrors()” is null
java.lang.NullPointerException: Cannot invoke “java.util.List.get(int)” because the return value of “com.squareup.square.exceptions.ApiException.getErrors()” is null
at app.square.integration.client.SquareException.(SquareException.java:55)
at app.square.integration.client.sdk.OrderClient.create(OrderClient.java:68)
at app.square.integration.service.OrderCreationService.create(OrderCreationService.java:77)
at app.square.integration.web.OrderSquareWebServiceImpl.create(OrderSquareWebServiceImpl.java:58)
at core.framework.web.Controller$OrderSquareWebServiceImpl$create$94.execute(Controller$OrderSquareWebServiceImpl$create$94.java)
at core.framework.internal.web.controller.InvocationImpl.proceed(InvocationImpl.java:51)
at app.square.integration.webhook.interceptor.WebhookInterceptor.intercept(WebhookInterceptor.java:31)
at core.framework.internal.web.controller.InvocationImpl.proceed(InvocationImpl.java:58)
at core.framework.internal.web.HTTPHandler.handle(HTTPHandler.java:112)
at core.framework.internal.web.HTTPHandler.handleRequest(HTTPHandler.java:78)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
at java.base/java.lang.Thread.run(Unknown Source)
00:05.774756781 c.f.i.w.response.ResponseHandler - [response] statusCode=500
00:05.774757792 c.f.i.w.response.ResponseHandler - [response:header] Content-Type=application/json

Have you checked the API Logs to see if the request made it to our servers? :slightly_smiling_face:

yes, below are screenshots:


create_order_e2

create_order_e4

it seems gateway timeout.

create time in our system log matches api log in the new screenshots.

please ignore the first screenshot in our system log, it will be the same problem, i just cann’t find the whole log to match.

Are you closing the the port before we return a response? I can’t think of any other reason it would be null. :slightly_smiling_face:

i do not know also. it elapsed only 5.134 s from begin to request, if it takes too long, our system may be closing the port.

Do you have the idempotency_key of a failed attempt? :slightly_smiling_face: