Questions tagged [node-fetch]
462 questions
0
votes
0 answers
Not receiving the API call output from a fetch function in NodeJS
I want to retrieve data from a API call and send the results to the user in NodeJS. There are separate functions for the API call and for the route call. The data is print to the console within the API call function, but not been sent to the route…

Kavishka Dulshan
- 3
- 1
0
votes
2 answers
Async function returns promise after .then
In my code, I have an async function that returns a promise.I am aware that this question has been asked before, however none of the solutions worked.
const fetch = require('node-fetch');
async function getData() {
const response = await…

Arjinoodles
- 56
- 9
0
votes
1 answer
{"status":400,"message":"missing client id"} response when using node-fetch
I am trying to get an oauth token from Twitch, and with this code:
import dotenv from 'dotenv';
dotenv.config();
import fetch from 'node-fetch';
let creds = {
client_id:process.env.CLIENT_ID,
…

user992286
- 295
- 1
- 3
- 6
0
votes
1 answer
Require.js module(node-fetch) load for contex error
I'm making a website and I'm struggling with Require.js.
I want to require node-fetch package:
const fetch = require('node-fetch');
// Getting avatar of random discord user
const token = process.env.TOKEN;
async function fetchit() {
const…

Krix
- 45
- 1
- 9
0
votes
0 answers
node-fetch not working but axios is working fine
I have an express server on localhost from which I am making an Api call
function get(){
console.log('calling get')
fetch('https://www.nseindia.com/api/marketStatus')
.then(val=>{console.log(val)})
.catch(err =>…
0
votes
1 answer
Node Fetch resolve host like curl request
can we replicate curl resolve host in node-fetch or any other node http library.
curl https://www.example.net --resolve www.example.net:443:127.0.0.1

Faizan Ahmed
- 184
- 3
- 12
0
votes
2 answers
Clash Royale Node Fetch with Key
Im trying to make a discord bot where if you type -cr into the chat, it takes the Arguments of the user (Being the Clash Royale Player's player tag) and would then use the package node-fetch to receive data with my specified endpoint. I am…

Tachanks
- 83
- 5
0
votes
1 answer
Node.js SSL error: wrong version number: ../deps/openssl/openssl/ssl/record/ssl3_record.c:332
Using Node.js and cross-fetch, I receive an error accessing an HTTPS site (see title and comments below). There is no proxy involved. The code below is a simplified version that reproduces the error. The comments in the code contain the exact error…

Ed L.
- 369
- 3
- 6
0
votes
1 answer
Jest error "Cannot use import statement outside a module" when importing node-fetch even with the CommonJS format
I'm pretty new to node.js and I'm confused with the import/export system. If I install a package using NPM in my project's node_modules directory, should I eye-check it to know whether it has used the ES6 module system or the CommonJS module system…

aderchox
- 3,163
- 2
- 28
- 37
0
votes
1 answer
Need to convert PHP Curl Request to JavaScript (Node.js)
Currently I am having Curl request in PHP like below,
$url = "http://localhost:8500/v1/catalog/service/api?passing&tag=%2Fu%2Fdeepak%2F211%2Flocalhost"
$ch = curl_init($url);
function _exec($ch) {
curl_setopt($ch, CURLOPT_RETURNTRANSFER,…

Deepak
- 119
- 1
- 8
0
votes
1 answer
node-fetch stream file to nodemailer, and then nodemailer to send the file as attachment
I'm trying to send a file along with other fields on the state in Nextjs using node-fetch.
the goal is not to store the file on the server (even temporarily) but to stream it from the web browser as the user submits the form to the Nodemailer, and…

Mostafa Esmaeili
- 85
- 1
- 9
0
votes
1 answer
node-fetch proxy a remote file as response
I have a node application which needs to do the following:
POST a request with some HTML in the body to a PHP API that returns a PDF
Return the PDF directly to the browser
I am trying something like this with node-fetch:
const response = await…

waffl
- 5,179
- 10
- 73
- 123
0
votes
0 answers
How can I send data from a JSON into a constante variable using Node Fetch? TypeError [ERR_INVALID_URL]: Invalid URL
I'm working in a NodeJS project, and I'm expecting to take data from a JSON and then send it into my app2.mjs to a constant variable, to then send them into an array of objects to after that save it into a DB, the issue I'm having is that I send…

Martín JF
- 152
- 2
- 14
0
votes
1 answer
SyntaxError: Unexpected identifier for "fetch"
I was making a discord bot using NodeJS, and everytime i go boot up the bot it shows this error:
headers = (await fetch(filtered.fileUrl, { method: 'HEAD' })).headers
^^^^^
SyntaxError: Unexpected identifier
What i knew is that,…

dimactavish
- 11
- 3
0
votes
1 answer
How to filter fetched JSON data?
I'm trying to make a simple command that pulls info from imgur, finds the images, and from there randomly decides which photo to show. The problem I'm having is that I can't seem to filter the responses based on certain criteria. Here is the…

Koto
- 430
- 4
- 19