react-papaparse icon indicating copy to clipboard operation
react-papaparse copied to clipboard

readString: An argument for 'config' was not provided

Open sunrisep12 opened this issue 3 years ago • 4 comments

I've been using this library for a while but from today it started throwing an error at readString(). I have this const parsedCsv = readString(csvString); from which, later on, I grab parsedCsv.data and parsedCsv.meta.delimiter for my purposes. But now, I can't do that as I get an error that says An argument for 'config' was not provided.. Is there a way to set this config to null and retrieve this data without readString(str, {worker: true, complete: res => someVar = res.data, someDelimiterVar = res.meta.delimiter}) etc. because on this way I should be dealing with async/await if I'd like to assign the data I need to my values, which I'd like to avoid.

sunrisep12 avatar Nov 05 '21 14:11 sunrisep12

@sunrisep12

readString API has been changed in latest version 3.18.0 as following:

readString(csvString, {
  worker: true,
  complete: (results) => {
    console.log(results)
  }
})

Please kindly check the docs on readme or website. Thanks!

Bunlong avatar Nov 05 '21 14:11 Bunlong

Getting same error trying to use readRemoteFile, what is the fix/workaround? Sorry very limited React knowledge, don't really understand what the above response means. Config is not being recognised at all, nor can I leave it blank although documentation says its 'optional'.

Edited Today (24/11) I rolled my install back to version 3.17.2 and the problem went away, its a bug.

flowerbot avatar Nov 23 '21 05:11 flowerbot

@flowerbot @sunrisep12

radString API has been changed from:

const parsedCsv = readString(csvString, { worker: true });

To

readString(csvString, {
  worker: true,
  complete: (parsedCsv) => {
    console.log(parsedCsv);
  }
});

Bunlong avatar Nov 24 '21 17:11 Bunlong

I was also struggling with this after the update. Looks like the docs are not up to date here https://react-papaparse.js.org/docs#strings. Also, why is worker a required prop if it should be always true, in this case?

plotka avatar Dec 15 '21 18:12 plotka