Questions tagged [node-fetch]

462 questions
1
vote
0 answers

Dropbox 400 Error while trying to get token (auth)

EDIT: I FOUND THE MISTAKE THAT I WAS MAKING: I WAS SENDING DATA IN JSON FORMAT AND DROPBOX DOESN'T EXPECTS DATA IN THAT FROMAT. My question: I hope this helps others. I am trying to learn and understand the OAuth 2.0 by implementing different…
Ranjeet Kumar
  • 11
  • 1
  • 2
1
vote
0 answers

How to know if the image is loaded properly while fetching through url

im trying to fetch an image through url in nodejs ( using node-fetch ), something like this fetch(url) .then(async res => { const dest = fs.createWriteStream(filename); res.body.pipe(dest) }) .catch((err) => { …
1
vote
1 answer

Fetch data from an API in regular interval in NodeJS

I want to fetch data from an API in regular interval. I wrote a script which is fetching data successfully but how to repeat this step for infinite time, so that I can fetch data in regular interval. I want to fetch data in the interval of 1sec,…
Harsh
  • 45
  • 5
1
vote
0 answers

Browserify doesn't send data to write function

I am using this code to take user input, process it into a usable format and then post it to a Node Express server. When the write function is called the data is 'undefined'? when I open this code as a file in the browser it works fine except for…
Oss Kell
  • 53
  • 6
1
vote
2 answers

Why does Node-Fetch Increasingly Take Longer to Fetch in a Running Loop for 600 Reps As Loop Gets Longer?

I was testing node-fetch and decided to use it in a project. In this project, I repeatedly fetch a resource, up to 600 times over the course of a couple of minutes. However, when I was testing Node-Fetch, I discovered some odd behavior: when I…
imaginate
  • 567
  • 2
  • 13
1
vote
0 answers

Javascript - POST request in NodeJS not working, while it does in browser

So I'm trying to duplicate a web request in NodeJS, here is my code: const fetch = require('node-fetch'); (async () => { let t = `working_access_token` let uid = 'user_ID' let url =…
Arcerion
  • 11
  • 2
1
vote
0 answers

How to sign request object and send request?

i am using nodejs with node-fetch library to send a requests and node-http-signature package for sign request. Node-fetch has only one method to send request fetch(). How can i create request object, than pass this object to sign() method from…
Lukasz_K_K
  • 387
  • 3
  • 13
1
vote
1 answer

Can't get text from a div

I want to get the content of the div mw-content-text from some wikipedia page (this is just examples to learn node.js) I have made this: var fetch = require('node-fetch'); var cheerio = require('cheerio'); var fs = require('fs'); var vv =…
Richard
  • 994
  • 7
  • 26
1
vote
1 answer

Nodejs - Capture an array of objects returned by function containing nested asynchronous fetches

I've tied myself up in knots trying to return from a function which uses chained asynchronous node-fetches. Please help since I'm not familiar with promises and the like In the function MessgSums() I am initially fetching a list of conversations…
pcodex
  • 1,812
  • 15
  • 16
1
vote
1 answer

node-fetch with ipv6 proxy

Do you know any way to use node-fetch (or similar package), with an ipv6 proxy ? I'm stuck on this "small" point. I tried to const fetch = require('node-fetch'); const HttpsProxyAgent = require('https-proxy-agent'); class Something { async init…
MathKimRobin
  • 1,268
  • 3
  • 21
  • 52
1
vote
0 answers

Send array in fetch body Node

I need to send an array in the body of a fetch request. The value fields has to be an array with lastName and some other values. How do I go about this? I've tried let fields = JSON.stringify({ lastName: "test" }); but that did not work.…
Coen Visser
  • 23
  • 1
  • 6
1
vote
1 answer

How to pass data in node-fetch module with basic authentication in node js

Can someone help with this code. When I pass a "post" request with basic auth status is 200 but nothing comes in response.With out auth the same code works let username = 'username'; let password = 'password'; let headers = new…
Hemanth
  • 13
  • 1
  • 4
1
vote
1 answer

How to use AWS Lambda to fetch a webpage and return body and headers

I am trying to use Lambda functions to fetch a webpage, and then return both the content and the response headers. Following is my code which always return "Internal server error" when triggered by Gateway API, I am confused with how to construct…
dovod74538
  • 113
  • 2
  • 9
1
vote
3 answers

Looping through API response Node JS

I'm trying to pull data from an API and insert it into a MySQL Database. The API has over 100 objects but I can't find any information on how to do this? I'm using node-fetch to output the Json Data but can't loop through each object? I've added a…
Charlie Simon
  • 133
  • 12
1
vote
1 answer

Express routes not called with node-fetch

I have an express server with one route. When I call this route in my browser I am able to get data sent by my server. However when I try to call this route from script with a simple node-fetch I have an response but my route is not called (not data…
onedkr
  • 3,226
  • 3
  • 21
  • 31