question

blackthreaddev avatar image
blackthreaddev asked blackthreaddev answered

Getting 500 error "Java heap space" when testing API on Docs page Create Checkout

I am using the API test on the https://docs.clover.com/reference/createcheckout# page. When I click the "Try it!" button, it returns below json.
Is the server broken?

{
"timestamp": "2023-08-23T01:37:08.552+00:00",
"status": 500,
"error": "Internal Server Error",
"trace": "java.lang.OutOfMemoryError: Java heap space\n\tat java.base/java.util.Arrays.copyOf(Arrays.java:3745)\n\tat java.base/java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:172)\n\tat java.base/java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:538)\n\tat java.base/java.lang.StringBuilder.append(StringBuilder.java:178)\n\tat java.base/java.lang.StringBuilder.append(StringBuilder.java:172)\n\tat java.base/java.util.AbstractCollection.toString(AbstractCollection.java:473)\n\tat com.clover.api.order.LineItems.toIndentedString(LineItems.java:111)\n\tat com.clover.api.order.LineItems.toString(LineItems.java:98)\n\tat com.clover.api.order.Order.toIndentedString(Order.java:653)\n\tat com.clover.api.order.Order.toString(Order.java:628)\n\tat java.base/java.lang.String.valueOf(String.java:2951)\n\tat java.base/java.lang.StringBuilder.append(StringBuilder.java:172)\n\tat org.springframework.web.client.RestTemplate$HttpEntityRequestCallback.logBody(RestTemplate.java:1007)\n\tat org.springframework.web.client.RestTemplate$HttpEntityRequestCallback.doWithRequest(RestTemplate.java:981)\n\tat org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:774)\n\tat org.springframework.web.client.RestTemplate.execute(RestTemplate.java:711)\n\tat org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:602)\n\tat com.clover.invoicingcheckoutservice.cos.service.CosOrderServiceImpl.calculateOrderLogic(CosOrderServiceImpl.java:417)\n\tat com.clover.invoicingcheckoutservice.cos.service.CosOrderServiceImpl.lambda$calculateOrder$6(CosOrderServiceImpl.java:407)\n\tat com.clover.invoicingcheckoutservice.cos.service.CosOrderServiceImpl$$Lambda$2893/0x0000000101707040.get(Unknown Source)\n\tat io.micrometer.core.instrument.composite.CompositeTimer.record(CompositeTimer.java:57)\n\tat com.clover.invoicingcheckoutservice.cos.service.CosOrderServiceImpl.calculateOrder(CosOrderServiceImpl.java:407)\n\tat com.clover.invoicingcheckoutservice.checkout.service.CheckoutServiceImpl.buildCheckoutSession(CheckoutServiceImpl.java:371)\n\tat com.clover.invoicingcheckoutservice.checkout.service.CheckoutServiceImpl.create(CheckoutServiceImpl.java:118)\n\tat com.clover.invoicingcheckoutservice.checkout.service.CheckoutServiceImpl$$FastClassBySpringCGLIB$$9a90233.invoke(<generated>)\n\tat org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)\n\tat org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)\n\tat com.clover.invoicingcheckoutservice.checkout.service.CheckoutServiceImpl$$EnhancerBySpringCGLIB$$ecd2d67.create(<generated>)\n\tat com.clover.invoicingcheckoutservice.checkout.controller.CheckoutController.createCheckout(CheckoutController.java:84)\n\tat com.clover.invoicingcheckoutservice.checkout.controller.CheckoutController$$FastClassBySpringCGLIB$$92790bb1.invoke(<generated>)\n\tat org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)\n\tat org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:779)\n",
"message": "Java heap space",
"path": "/invoicingcheckoutservice/v1/checkouts"
}

e-commerce api
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

parquet76 avatar image
parquet76 answered parquet76 edited

Just use postman or curl. The doc page is probably building the request wrong. I agree the server should certainly not be throwing an oom. Someone from clover needs to look at this

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

blackthreaddev avatar image
blackthreaddev answered

@parquet76@gmail.com I get the same error using curl.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bryanvargas avatar image
bryanvargas answered bryanvargas commented

I just ran it through docs and postman and did not run into any issues. Can you try again?

2 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

blackthreaddev avatar image blackthreaddev commented ·

there's progress; a new error:

{
"status": {
"reason": "Unauthorized",
"code": 401
},
"message": "COS get merchant failed with exception: 401 Unauthorized: [{\"message\":\"401 Unauthorized\"}]"
}


0 Likes 0 ·
bryanvargas avatar image bryanvargas ♦♦ blackthreaddev commented ·

Check out how to troubleshoot 401 errors https://docs.clover.com/docs/401-unauthorized

0 Likes 0 ·
blackthreaddev avatar image
blackthreaddev answered

I added merchant permissions to my private API token. It works now.screenshot-2023-08-23-at-120319-pm.png


10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

blackthreaddev avatar image
blackthreaddev answered

I assume refreshing the page, making sure all the required parameters had data, and setting the correct permissions did the trick.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community