netsuite
netsuite copied to clipboard
Errors thrown on successful request to Netsuite
My team noticed that Some of the NetSuite::Actions can throw an empty Netsuite::Error even on a successful request/response from Netsuite.
For instance, in lib/netsuite/actions/upsert.rb:
def errors
error_obj = response_hash[:status][:status_detail]
error_obj = [error_obj] if error_obj.class == Hash
error_obj.map do |error|
NetSuite::Error.new(error)
end
end
We have noticed that sometimes Netsuite returns status of 'success' and a status_detail of {:failed_after_submit => false}. This is basically detail about the success. The code above identifies this status detail and throws an error. Since there is no code, type, or message, the error is empty:
#<NetSuite::Error:0x00007fe073addd50 @type=nil, @code=nil, @message=nil>
I would be happy to put in a Pull Request for this. Not sure how your team handles this type of thing.
Thanks!
@kmwalke I've never run into this. Any chance you have the request/response XML? What API version are you using?
Thanks for the response. Unfortunately, I do not have the XML. I'll look into getting that.
Looks like we are using version 2018.2 .
@kmwalke Getting the XML response will be key in figuring out what is causing those empty errors to be generated.
Ah, interesting. 2018_2 is relatively recent, so I'm guessing there is a new structure in the XML response that we need to handle.
@iloveitaly I am seeing this in 2020_1 with gem version 0.8.5. Below is the response body.
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<platformMsgs:documentInfo xmlns:platformMsgs="urn:messages_2020_1.platform.webservices.netsuite.com">
<platformMsgs:nsId>WEBSERVICES_TSTDRV123456_0903202014342779621573904464_b633a</platformMsgs:nsId>
</platformMsgs:documentInfo>
</soapenv:Header>
<soapenv:Body>
<addResponse xmlns="urn:messages_2020_1.platform.webservices.netsuite.com">
<writeResponse>
<platformCore:status xmlns:platformCore="urn:core_2020_1.platform.webservices.netsuite.com" isSuccess="true">
<platformCore:statusDetail>
<platformCore:afterSubmitFailed>false</platformCore:afterSubmitFailed>
</platformCore:statusDetail>
</platformCore:status>
<baseRef xmlns:platformCore="urn:core_2020_1.platform.webservices.netsuite.com" internalId="2587502" type="customerDeposit" xsi:type="platformCore:RecordRef" />
</writeResponse>
</addResponse>
</soapenv:Body>
</soapenv:Envelope>
@robfarmergt awesome, now that we have a sample error, we can fix the issue! Would you be able to create a PR to fix this?