I am getting this error: " UnhandledPromiseRejecti...
# community-help
t
I am getting this error: " UnhandledPromiseRejectionWarning: Error: Request failed with HTTP code 404 | Server said: Not Found". I have the server running in Docker.
j
Could you share the code snippet you're using that threw that error?
t
readline.createInterface({         input: fs.createReadStream("./test.jsonl"),         terminal: false     }).on('line', function(line) {        let document = JSON.parse(line);        typeClient.collections('parts').documents().create(document)     });
j
Could you double-check the name of the collection:
collections('parts')
You'd first want to create a collection with that name, before adding documents to it
t
okay I will try that
I am now getting this error: "UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of null"
would that be due to my jsonl file?
Also, If I just want to read a jsonl object, can I just do this: readline.createInterface({         input: jsonLObject,         terminal: false     }).on('line', function(line) {        let document = JSON.parse(line);        typeClient.collections('parts').documents().create(document)     });
j
jsonl by definition is a string-based format... so it won't parse directly into a javascript object
I am now getting this error: "UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of null"
Could you post the full code snippet?
j
I only see use of
map
once in that snippet. So may be it's this line that's erroring out:
Copy code
const nkList = await getAsync('nk');
    let nkJson = JSON.parse(nkList);
Usually if you're trying to specify a local file, you'd do
./nk
relative to your app root