I am getting below error when I try to convert from CSV to JSON
{ "fault": { "faultstring": "JavaScript execution failed: Cannot find function makeRequest in object [object Object].: TypeError: Cannot find function makeRequest in object [object Object].\n at /organization/environment/api/index.js:50\n at /organization/environment/api/node_modules/csvtojson/libs/core/Converter.js:419\n at g (events.js:180)\n at emit (events.js:95)\n at /organization/environment/api/node_modules/csvtojson/libs/core/Converter.js:306\n at /organization/environment/api/node_modules/csvtojson/libs/core/Converter.js:346\n at /organization/environment/api/node_modules/csvtojson/libs/core/Converter.js:323\n at _stream_transform.js:130\n at g (events.js:180)\n at emit (events.js:92)\n at finishMaybe (_stream_writable.js:359)\n at endWritable (_stream_writable.js:366)\n at _stream_writable.js:344\n at /organization/environment/api/node_modules/csvtojson/libs/core/Converter.js:407\n at _tickDomainCallback (trireme.js:491)\n at _tickFromSpinner (trireme.js:422)\n", "detail": { "errorcode": "scripts.node.ScriptExecutionError" } } }
@Reshma, you should provide more details to help us. This seems to be a code issue. We will need to see the code to figure out the problem.
I placed code
Hi, I found this link useful.
https://gist.github.com/jssuttles/8fb8b16a152558906469dfefbf88f658
This is the following code
aws.config.update({ "accessKeyId": accessKeyId, "secretAccessKey": secretAccessKey }); var s3 = new aws.S3({ "apiVersion": '2006-03-01' }); var bucket = s3Bucket; var key = fileName+".csv"; var params = { Bucket: bucket, Key: key, }; s3.getObject(params, function(err, data){ if (err) { console.log(err); res.status(500); res.send(err); } else { var jsonOutput; var output = data.Body.toString("utf-8"); var Converter = csv.Converter; var converter = new Converter({}); converter.fromString(output,function(err,result){ jsonOutput = result; var uri = "https://"+BaaSURL+"/"+app_name+"/"+baascollectionName+"_"+dbset+"?access_token="+access_token; dataManager.makeRequest(jsonOutput,access_token, uri, function(error,body){ if(error){ console.log("error = "+error); } else{ console.log("body = "+body); } res.send("done"); }); }); }
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |