3

I am trying to send a table of about 140 rows and 5 columns as a JSON object (around 20 KB in size) from VBA using MSXML2.ServerXMLHTTP in a body of a POST request to an endpoint made available from R using plumber API package. The endpoint/function running in R on the server is throwing the following error: simpleError in fromJSON(requestList): argument "requestList" is missing, with no default

requestList is the parameter passed to the endpoint function. It looks like it gets lost in the web call. If I reduce the table size to 30 rows instead of 140 rows, requestList is found and the request is served successfully.

My platform is as follows: 1. Endpoints are written in R and exposed using Plumber API. 2. Endpoints are running on AWS instance with Redhat 7.5. 3. Timeout for the request is set to 100 minutes on VBA (client side).

Tiger
  • 87
  • 7
  • I would tend to say that one of your data in the JSON lines going from row 31 to 140 contain a special character that makes the parameter working on client side but breaking the request on server side on deserialization. Have you tried to send 1-30, then 31-60, then 61-90 etc. in order to make sure it's not about the data you're sending? – Matteo NNZ Jan 24 '19 at 23:18
  • Thanks Matteo. I have encountered errors due to parsing of the JSON object on the server side and the message would say that it is some parsing issue but at least it would recognize the parameter sent as JSON object. But I will try your approach to see if there is a problem with the parsing of JSON on the server side. – Tiger Jan 24 '19 at 23:25
  • Thanks Matteo. Despite the server side does not mention anything about issues parsing JSON object. It looks like you said. Please put it up as answer so I can check it out pending more testing. – Tiger Jan 24 '19 at 23:40
  • Sure, will do that. – Matteo NNZ Jan 24 '19 at 23:45

2 Answers2

1

If fromJSON(requestList) is:

  • working when it has 30 rows
  • raising an error of type argument "requestList" is missing, with no default when having 140 rows

... considering that JSON bodies have no size limits (and even if they had, for sure it wouldn't be 20 KB), I would say that the issue is in the data contained in the rows 31-140.

There must be some special character which goes through fine at serialization on VBA client side (i.e. the data are correctly serialized because VBA tolerates that special character) but when deserializing on server side, this special character breaks the request as if the input wasn't actually an input.

My suggestion to troubleshoot would be to chunk your request in blocks of 30 (1-30, 31-60, 61-90 etc.) until when you find the guilty chunk, and then going by bisection on that chunk until you detect the special character breaking it.

Matteo NNZ
  • 11,930
  • 12
  • 52
  • 89
0

Increasing the request size limit for Plumber helped me:

options_plumber(maxRequestSize = 10 * 1024 * 1024) (or more)

At least for prototype work this is great. Once you're optimizing things for production, you should improve your communications to send only what is required.

meow
  • 925
  • 7
  • 22