CSV Import error in NodeJS

Wappler Version : 3.0.1
Operating System : Win10 latest

The Import CSV File server connect action is causing the following error in Nodejs in the console:

{status: "500", message: "csv.split is not a function",…}
message: "csv.split is not a function"
stack: "TypeError: csv.split is not a function↵    at parseCSV (/opt/node_app/lib/modules/import.js:14:20)↵    at App.csv (/opt/node_app/lib/modules/import.js:45:16)↵    at async App._exec (/opt/node_app/lib/core/app.js:224:30)↵    at async App._exec (/opt/node_app/lib/core/app.js:206:17)↵    at async App.exec (/opt/node_app/lib/core/app.js:177:9)↵    at async App.define (/opt/node_app/lib/core/app.js:160:9)"
status: "500"

I am quite sure I excluded all other possible causes of this error and even using a static .csv file (which imports flawlessly in PHP) or .c file causes this error if it’s the only action in my server connect script. So, I suppose it’s a bug, only in nodejs, in php it still works fine.

Please let me know if you need more details.

1 Like

Is there any news on this topic @patrick? Is it a bug indeed or something on my end?
Thanks in advance for letting me know.

Patrick is currently not available, having his summer vacation with his family.
He will check your issue when he’s back in a week or so.

Okay, thanks for your quick response.
So a fix can be expected at the soonest in the update on Thursday 23th then, right?

The fix can be expected in the next update, which will not be on 23th of July.
We will resume to weekly updates in the beginning of August.

Ouch, that’s bad news :confounded:
I guess there’s no other option for me then waiting for the fix on August 6th (?) then.

I’m still working on a bigger update, but here a small update for the split error. File is located in lib/modules.

import.zip (803 Bytes)

1 Like

Awesome @patrick, very glad to receive this.

I found a temporarily solution in changing
let data = csv.split(/\r?\n/);
into
let data = csv.toString().split(/\r?\n/);
and quoting out lines 24-26.

However there was always an extra (empty) line imported with that workaround, so I’m very happy with this probably better solution! :smiley:

Will test it and let you know my findings, thank again.

The import needs a big update, the current version is very simple and doesn’t work on all csv files. It requires a proper parser instead of the split method used currently. I don’t think my solution fixes the extra empty line, since the fix is almost the same as you had.

1 Like

Okay I see, but I will try :slight_smile:

Hope the big update will be available soon…

Actually your solution still throws the error: parseCSV: error parsing csv.
So I quoted that part out to make it “work” for now.
Can you give any due date to be expected for the big update of the import module? :grimacing:
I depend a lot on reliable import modules (csv and xml) for my projects.
Thanks for you reply in advance.

Could you send me one of your csv files in a private message, then I can test with that. It probably contains some quoted escapes that causes the error and the import doesn’t support that at the moment. Also the xml import is not yet implemented.

Will give it some priority and send you the file as soon I have some update.

I have improved the CSV import. XML import is not yet available.

import.zip (1.1 KB)

1 Like

This is fixed in Wappler 3.0.2

1 Like

This topic was automatically closed after 2 days. New replies are no longer allowed.