Closed betterm closed 6 years ago
Hi @betterm. Did you try with a JSON without keys as strings? (use symbols as regular).
@lu1s of course, currently we are using symbol keys, but it doesn't matter which keys I put, it works in both ways
Can you share more context on how is that part of the code implemented in your snippet?
Well, I shared the whole part where the error happens, there just request hash, the order create request line it self, and then rescue, with the error message I also shared here. What else can be useful?
@betterm is this error still happening ? i remember that was an error during some deployment we done, our balancer some times returns empty response if it was not able to reach api response in that specific date range
Hi, we have some problems during Oxxo Conekta order create, it happens only sometimes it seems. Here our request:
request_params = { "line_items": [ { "name": "Shipment ECOEXPRESS", "unit_price": 7334, "quantity": 1 } ], "shipping_lines": [ { "amount": 0, "carrier": "Redpack", "tracking_number": "U5UT96B1" } ], "currency": "MXN", "customer_info": { "name": "Client Name", "email": "client@email.com", "phone": "1122334455" }, "shipping_contact": { "phone": "1122334455", "receiver": "Receiver Name", "address": { "street1": "Kepler 195", "city": "Mexico", "state": "DF", "country": "MX", "postal_code": "11590", "residential": true } }, "charges": [ { "payment_method": { "type": "oxxo_cash" } } ], "metadata": { "enviaya_payment_id": 89854, "target_model": "Shipment", "target_id": 1359361, "model_amount": 69.95, "order_id": 81717 } }
conekta_order = Conekta::Order.create(request_params)
Then we get this error:
A JSON text must at least contain two octets! "/home/ubuntu/apps/enviaya/shared/bundle/ruby/2.4.0/gems/json-1.8.6/lib/json/common.rb:155:in
initialize'", "/home/ubuntu/apps/enviaya/shared/bundle/ruby/2.4.0/gems/json-1.8.6/lib/json/common.rb:155:in
new'", "/home/ubuntu/apps/enviaya/shared/bundle/ruby/2.4.0/gems/json-1.8.6/lib/json/common.rb:155:inparse'", "/home/ubuntu/apps/enviaya/shared/bundle/ruby/2.4.0/bundler/gems/conekta-ruby-f6028bc9800b/lib/conekta/requestor.rb:33:in
request'", "/home/ubuntu/apps/enviaya/shared/bundle/ruby/2.4.0/bundler/gems/conekta-ruby-f6028bc9800b/lib/conekta/operations/create.rb:7:increate'"
So it seems response body is empty string, and we receive the error in JSON parse...