Open pomSense opened 2 years ago
First of all, sorry for the very late reply. X12 has ended up low priority due to some unexpected life circumstance stuff.
Second, this is REALLY weird for a bug.
I'm going to take a close look at the parser and see what's going on.
@pomSense Do you have an example of the dataset that's triggering the error? The parser is expecting to encounter an element delimiter to instantiate currentElement
; if no delimiter is encountered, or the segemnt is malformed in some other way, then currentElement
won't get assigned. This might explain the bug.
Regardless, I'm going to give this project a little love over the next month. js-edi
is not mature enough and I'd like to get an X12 parser working on Deno.
Hey, @pomSense! Your issue might be related to this PR: #26
All code from the PR should be in the beta: npm install node-x12@beta
Please give that a try and let me know if it fixes your issue.
@pomSense The Deno migration may have uncovered the source of the bug you are reporting.
I think I need to change https://github.com/aaronhuggins/node-x12/blob/a1d2515faca8ae98c5a7d131f03fc04b43c33865/src/X12Parser.ts#L202-L205
to definitely assign currentElement
, like:
let currentSegment: X12Segment = new X12Segment()
let currentElement: X12Element = new X12Element()
Looking at the original x12 codebase, I believe this would be as old as the library before I took it over.
Over the next week, I'll be further along enough to say for sure. If it gets fixed in the Deno migration effort, I'll back-port it to the 1.7.x release and publish before I merge the Deno changes.
First of all, sorry for the very late reply. X12 has ended up low priority due to some unexpected life circumstance stuff.
Second, this is REALLY weird for a bug.
I'm going to take a close look at the parser and see what's going on.
Hey no problem man, life happens!
@pomSense Do you have an example of the dataset that's triggering the error?
The data was using the following 4 files repeated again and again up to 150+ times. These are variations of actual prod data (with sensitive info changed) that I was trying to ramp up to test the performance of the aforementioned stream processor.
Please give that a try and let me know if it fixes your issue.
Do you still want me to give this a try or wait for port back to 1.7.x?
Let me know and I'll try what you need to see if it works. Thanks again @aaronhuggins
Hey @pomSense! Got my attention while I'm kid-free for a few minutes!
Do you still want me to give this a try or wait for port back to 1.7.x?
I've decided not to backport, because there were a few bugs I caught during migration due to some of Deno's stricter TypeScript defaults. It was a little unwieldy trying to keep track of the changes for each file so that I could cherry-pick.
If you're up for it, I'm literally 5 minutes away from releasing another prerelease 1.8.0-1
. I'd like it if you gave that a try to see if it fixes your issue.
Or maybe it blows up something for you! I'm not 100% sure yet. I'd like to get my test coverage a little higher before an official minor version bump.
Build action is running...
Pre-released!
Hey @pomSense! Got my attention while I'm kid-free for a few minutes!
Do you still want me to give this a try or wait for port back to 1.7.x?
I've decided not to backport, because there were a few bugs I caught during migration due to some of Deno's stricter TypeScript defaults. It was a little unwieldy trying to keep track of the changes for each file so that I could cherry-pick.
If you're up for it, I'm literally 5 minutes away from releasing another prerelease
1.8.0-1
. I'd like it if you gave that a try to see if it fixes your issue.Or maybe it blows up something for you! I'm not 100% sure yet. I'd like to get my test coverage a little higher before an official minor version bump.
I'll give this a try later tonight. Thanks so much for getting this out. I'll run few scenarios as well
Description
Hey @aaronhuggins, first of all, amazing package. I've been following this and the progress of js-edi, and currently using node-x12 in production.
I was upgrading our current implementation of node-x12 to use a stream processor where we continuously stream process edi files received over a file server.
I am running into this strange error and was trying to see if you had any idea. When I am running 5 edi files, works fine. Then I double that to 10, using the same files, still good. I continue doubling to check the performance of the same files, and I start getting strange behavior after 30 files. Sometimes it works up to 150 files, but then getting this error randomly:
From the node_modules, it is this exact line:
Looking at the source code, it seems
currentSegment.range
is throwing in_parseSegments
, but doesn't make sense since it is instantiating newX12Segment()
and within itnew Range()
.I was certain it is due to something I am doing wrong, but wanted to get your take on it.
Here is how the stream processor is implemented using Highland:
Functions
I've been beating my head at this for few days now and just wanted to see if you noticed anything off, or is there something with the X12Parser? Any help would be appreciated!
Thanks again so much for making this package!