The response is undefined
lisasu-g opened this issue · 6 comments
Hi, I write a demo from the README file
const { investing } = require("investing-com-api");
async function main() {
console.log("begin");
const response = await investing("currencies/eur-usd");
console.log(`response is ${response}`);
// response = [ { date: Timestamp, value: Number }, {...}, ... ]
}
main();
and I get the result from the terminal. I don't know what's wrong. Thank you!
node ./main.js
begin
No response.data.candles found
response is undefined
It's working correctly to me, just tested. Please try with this code and let me know what it prints:
const { investing } = require('investing-com-api')
async function main () {
try {
const response = await investing('currencies/eur-usd')
console.log(response)
} catch (err) {
console.error(err)
}
}
main()
Firstly, I want to say thank you to you. The output information is below.
nvesting-node-test AlexLee$ node ./main.js
No response.data.candles found
undefined
I don't know, I think your code is not the same as the one I posted above.
Please give me your complete code and tell me your Node.js version (node --version), npm version (npm --version) and investing-com-api version (check package.json).
You can see the package working correctly here if you paste the code I posted above and clicking Run. Screenshot
.
Thank you for your reply.
I push everything to the GitHub repo(https://github.com/djangoIee/investing-com-api-demo).
Is there any chance that you could help me to check the code?
I don't know, I think your code is not the same as the one I posted above.
Please give me your complete code and tell me your Node.js version (node --version), npm version (npm --version) and investing-com-api version (check package.json).You can see the package working correctly here if you paste the code I posted above and clicking Run. Screenshot
.
node --version
v10.23.0
npm --version
6.14.8
Try to update to latest node version (v14) and post here you complete code, if different from above.