Questions tagged [node-fetch]

462 questions
0
votes
0 answers

node-fetch timeout issue/ express timeout/ lambda timeout or sth else?

below code works fine when running locally, but "getAccessToken ()" does not work as expected when running inside an aws lambda function, when doing "POST" to /webhook endpoint. I am using node 8.10, "aws-serverless-express": "^3.3.6", "express":…
0
votes
1 answer

How to save a fetched JSON in a variable [node-fetch]

I have the following code , which logs the json if I use a console.log, but I want to save it in the jsonBlocks variable. But it won't work. I guess its because of async stuff, but I cant find a way to solve it. var…
mouchin777
  • 1,428
  • 1
  • 31
  • 59
0
votes
1 answer

How to fetch and fs.writeFile a webpage with SJIS/Shift_JIS encoding

I am trying to fetch a page from the internet then save it into a HTML file. The page has this in the header:
bMain
  • 324
  • 3
  • 11
0
votes
1 answer

Curl corresponding request in node-fetch

It's been days I've been trying to make this curl request work with node-fetch without success. curl -X GET -u ":" --output hello_world.mp3…
Bradzer
  • 146
  • 2
  • 10
0
votes
1 answer

fetch response replaces Hebrew with question marks in black diamonds

const fetch = require("node-fetch") fetch("https://www.example.com") .then(res => res.text()) .then(data => console.log(data)) The output is HTML string, but Hebrew words replaced with ���� ���� How to set proper encoding to show Hebrew text…
AmirA
  • 194
  • 10
0
votes
1 answer

Ignore (or return) if there is error in node-fetch request

try { fetch(url) .then(res => res.json()) .then(data => { console.log(data); }); } catch (e) { console.log(e); } So sometimes I'm getting ECONNRESET Error from it, and I wish to just…
OlieW
  • 1
  • 1
  • 1
0
votes
1 answer

Kairosdb accepts only get request from node app

I have a VM running kairosDB on laptop A,the VM has two IPs: 192.168.119.132 : to access it from laptop A. 192.168.1.151 : to access from laptop B. From both laptops i can access the web app without any issue from < IP >:8080. Laptop A : If i…
0
votes
1 answer

How can I fetch an url using session data from puppeteer page?

I'm trying to enter a website with my credentials and download a pdf using puppeter. I got the pdf url using puppeteer, but now I want to use node-fetch to access that page. To fetch the pdf page I need to include the session data on options, but I…
Eduardo Conte
  • 1,145
  • 11
  • 18
0
votes
2 answers

Azure Function automatic retry on failure UnhandledPromiseRejectionWarning

const fetch = require('node-fetch'); let url = 'something.com'; module.exports = function(context) { let a = fetch(url) a.then(res => { if(res.status!=200) throw new Error(res.statusText) else{ context.done(null, res.body); …
0
votes
0 answers

node-fetch returned undefined values

I'm trying to write a code about GTFS with node-fetch. When I use the promise, It can return values but when I try to add them into an array for information filtering purposes. The system returned undefined values. What can I do with this…
Sen Cai
  • 1
  • 3
0
votes
1 answer

Getting timeout error (Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL)

For my API testing, my code behaving in different ways.I am using jasmine framework with node js.My GET request will give 2 responses Success json, with 200 status code. Response time is 400-500 ms Failure json, with 200 status code (valid…
johny
  • 51
  • 1
  • 11
0
votes
0 answers

Getting "Unhandled promise rejection" when calling a function (Cannot read property '0' of undefined)

For my API testing, my code behaving in different ways.I am using jasmine framework with node js. In my first code , I m using a sample API(REST GET request) In my second code, I m using my application API(REST GET request) 1.The code in my test…
johny
  • 51
  • 1
  • 11
0
votes
1 answer

Html button click and nodejs in javascript

I have created app.js to start the server which also have code for calling front end html page. In html, I have added click event where it calls another js file ex. myAccountForm.js, in this file I want to use expressjs for happening some…
0
votes
1 answer

Unable to get a value from a json after node fetch in javascript

For My API GET operation, I use node fetch and my code is var fetch = require('node-fetch'); const HttpProxyAgent = require('http-proxy-agent'); const HttpsProxyAgent =…
johny
  • 51
  • 1
  • 11
0
votes
2 answers

How to define a function which returns Promise to a Express Route function?

I have a business leve database module called "db_location" which uses the node-fetch module to get some data from a remote server via REST API. **db_location.js** DB LOGIC const p_conf = require('../parse_config'); const db_location = { …
alextc
  • 3,206
  • 10
  • 63
  • 107