Error when using a custom Javascript service with a 3rd party library

Hello! I am creating a service for my application in Javascript that relies on a 3rd party library called node-x12. Currently, I’m running into issues - I am trying to instantiate and returning an object belonging to node-x12. When calling this service from API services I’m running into an error.
Here is the code that I’m trying to run:

And here is the the error I receive when invoking this method. It appears that the object, interchange, is successfully able to be instantiated but there’s issues returning it

I am invoking this service via POST request, here is the request and the response:

image

I’m trying to wrap my head around what could be the issue, is it something on the side of my application?

My Application ID is 9B6A53C0-0171-45E3-857A-2776179566E9

Hello @braxton_kinney,

We are looking into the possible cause of the issue.
We will update you in this thread as soon as we have more information.

Regards,
Alexander

This error seems to be caused by the library when attempting to read the headers elements.
If you specify headers, the error does not occur (I used a random header, and everything worked without any issues)

...
const interchange = new X12Interchange(segmentTerminator, elementSeparator)
interchange.setHeader(ISAHeader)
...

Regards,
Alexander

Interesting! Specifying the headers prior to returning works on my end too. Thank you for the help!

1 Like