Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors thrown on successful request to Netsuite #444

Open
kmwalke opened this issue Feb 14, 2020 · 5 comments
Open

Errors thrown on successful request to Netsuite #444

kmwalke opened this issue Feb 14, 2020 · 5 comments

Comments

@kmwalke
Copy link

kmwalke commented Feb 14, 2020

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!

@iloveitaly
Copy link
Member

@kmwalke I've never run into this. Any chance you have the request/response XML? What API version are you using?

@kmwalke
Copy link
Author

kmwalke commented Feb 17, 2020

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 .

@iloveitaly
Copy link
Member

@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.

@robfarmergt
Copy link

@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>

@iloveitaly
Copy link
Member

@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?

iloveitaly pushed a commit that referenced this issue Jun 17, 2022
Addresses issue #444, where some successful requests return an empty error object. See https://system.netsuite.com/help/helpcenter/en_US/WSDiff/2018_2/FolderComparisonReport_files/FileComparisonReport24.html, line 914 for the change to the platformCore schema, https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4407992281.html for a description of afterSubmit scripts, and https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N3536574.html#bridgehead_1515748728 for a discussion of error reporting for these scripts.

Also added a line for File requests in the add action spec b/c the existing fixture already includes the `after_submit_failed` field.

Co-authored-by: Lily Burtness <[email protected]>
Co-authored-by: Shana Schundler <[email protected]>

Co-authored-by: Lily Burtness <[email protected]>
Co-authored-by: Shana Schundler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants