Questions tagged [node-fetch]
462 questions
3
votes
1 answer
TypeError: data.map is not a function
Im really stuck on this figuring out what did I miss, Im not that expert about javascript, if someone can please tell me what I did wrong, I really appreciate.
I have a working code:
if (value_ == "group") {
…

Poporingus
- 41
- 1
- 1
- 4
2
votes
1 answer
What is difference between node-fetch(nodejs) and requests(python)
python codes get response but javascript code can't get response.
what is diff between the two??
import fetch from 'node-fetch';
const url = "http://host3.dreamhack.games:15592/img_viewer"
const imageUrl = "/static/dream.png"
const data = {
…

lubiksss
- 31
- 4
2
votes
1 answer
When does a fetch promise resolve?
Let's say you fetch an image like so:
let promise = fetch("http://example.com/example.gif")
promise
.then(async res => {
// When does code here run?
// Has the entire image been transferred already upon resolve?
})
Is it correct to say that none…

Llama D'Attore
- 323
- 1
- 12
2
votes
0 answers
Got ERR_NON_2XX_3XX_RESPONSE upon simulating to self-hosted nodejs POST route
I am stuck in a demo app where i have added override fetch function of node-fetch npm package. Like this:
import Hook from "require-in-the-middle";
Hook(["node-fetch"], function (exported) {
const wrappedFetch = wrappedNodeFetch(exported);
…

Ritik Jain
- 89
- 1
- 6
2
votes
1 answer
How can I display an Image without downloading it from a url in NodeJS?
In NodeJS I used package named node-fetch, also for taking JSON Response, but how about an Image response? How can I do that? In my current codes, It does only save the image not showing like PIL from python.
var tr =…

Interesting
- 255
- 1
- 4
- 16
2
votes
3 answers
Abort this node-fetch request without aborting all other requests
The only way I found to set a timeout on a node-fetch request is to use the abort-controller:
import AbortController from 'abort-controller'
import fetch from 'node-fetch'
const fetchWithTimeout = async (url, options) => {
const controller = new…

stkvtflw
- 12,092
- 26
- 78
- 155
2
votes
1 answer
Fetching in a VSCode extension: node-fetch and node:http issues
I am very very new to VSCode extension development. So this may be a trivial question or something that already been discussed. But I can't get to make it work. So I am seeking out help.
I have a very simple extension that I am building at the…

SRC
- 2,123
- 3
- 31
- 44
2
votes
1 answer
Transpiling node-fetch require returns error
I'm running into an issue with the node-fetch library.
The new version (3.0.3) has "type": "module" in its package.json. This is a problem because I transpile my code from ES6 to regular js which uses require and then I get ...firebase_datasource.js…

Ben
- 2,957
- 2
- 27
- 55
2
votes
1 answer
node-fetch returns 403 while curl returns 200
I am trying to get a webpage to parse via node-fetch. node-fetch code looks like (AKA, copied from chrome inspector):
await fetch('https://www.scottycameron.com/store/user/login/', {
headers: {
'authority': 'www.scottycameron.com',
…

Spencer
- 31
- 3
2
votes
0 answers
Get a `ReadableStream` from Node's `IncomingMessage` type (request)
I am using plain Node (v14 rn) and node-fetch. I need to pass on the incoming body on to a downstream fetch.
The body option on node-fetch's RequestInit accepts:
| "Request body. can be null, a string, a Buffer, a Blob, or a Node.js Readable…

ConfusedNoob
- 9,826
- 14
- 64
- 85
2
votes
1 answer
Trouble while importing JSON Data to App.js
I have to pass JSON data from Data.js to App.js. If I console.log data in Data.js everything is okay, however when I try to pass it for using in cards it shows me this Error.
App.js
import React from "react";
import { Card, Button, Container, Row }…

Jeyhun085
- 21
- 4
2
votes
2 answers
How to send proxy and Certs over a axios or node-fetch call from nodejs
I've been trying to make an API call using axios and node-fetch and the end point needs to be connected via a proxy and also needs certs. below is what I'm trying to do
import axios from "axios";
import { getPrefetchedSSLConfig } from…

Itachi
- 61
- 1
- 10
2
votes
1 answer
How can I resolve ERR_REQUIRE_ESM error when using this simple node-fetch query?
I am trying to do a simple API fetch using node-fetch.
Getting the following error:
internal/modules/cjs/loader.js:1089
throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
^
Error [ERR_REQUIRE_ESM]: Must use import to load…

Gangrel
- 449
- 4
- 20
2
votes
1 answer
Node-express : fetch.Header() is not a constructor
I am using the node-fetch module in node-express app and earlier I used to do import it in this way:
const fetch = require("node-fetch")
But now with te=he version "node-fetch": "^3.0.0", it does not allow me to use require, instead it suggests to…

Nizar Kadri
- 321
- 2
- 10
2
votes
1 answer
Fetch binary file using node-fetch and send to react as binary data
I am trying to preview an image in my react application. I am trying to use node-fetch to fetch the binary data as stream and upon response, send the response data back to react application with proper content-type. The react code works fine as I…

Jyotirmoy Pan
- 837
- 2
- 10
- 28