All Questions
166 questions
1
vote
1
answer
131
views
400 bad request error posting thru node-fetch
const fetch = require("node-fetch").default;
let iApi = express.Router();
iApi.post("/update/:name/:value", async (req, res) => {
...
0
votes
3
answers
981
views
Inspecting outgoing HTTP requests in a nodejs application [closed]
I am using NestJS to build a web app from which I call an external API to retrieve data. Now, I want to inspect all the requests that are sent from my app. For example, in a web browser, I can inspect ...
1
vote
0
answers
216
views
How to get redirected query parameters into nodejs?
I am working on an app to track our outbound UPS packages using the UPS API. For those that do not know, they are implementing a OAuth token system to authenticate requests. This article shows the ...
6
votes
2
answers
6k
views
Differences between Node standard https and node-fetch when providing a certificate
ADP's REST API requires that a SSL certificate and private key be sent with every request.
When I use the 'standard, Node.js HTTP(S) module:
require('dotenv').config()
const fs = require('fs')
const ...
0
votes
1
answer
218
views
send very big data to an api in parallel and catching errors within promise.allSettled
I have quite big data, to be sent to an api with node-fetch. But, since there are many data in the array, and I want to send the data in parallel, I wanted to use promise.allSettled...
Yet, it still ...
0
votes
0
answers
88
views
node-fetch i trying get data but the execution still running and not returns
If i run the same request in postman it gives me a return in 9 minutes, with a 39mb of json data.
"node-fetch": "^2.6.7"
Same results with
node v16.6.2
node v17.9.1
const fetch = ...
1
vote
1
answer
641
views
Repetitive prompting with validation in Inquirer.js when using a validation function featuring fetch
In the context of Inquirer.js, one of my question-prompts involves a validation function to check if the user-supplied Github username exists. This validation function uses an fetch function in order ...
-2
votes
1
answer
1k
views
How to inspect response of Node-fetch in vscode
I'm working with node-fetch in vscode. I'm wondering if there is a way to inspect the request after the response has been obtained. I can set a breakpoint at the last line (arrow),
const r = await ...
0
votes
0
answers
14
views
Data is not defined error when fetching and parsing json using nodejs [duplicate]
const fetch = require('node-fetch');
const url = 'https://gist.githubusercontent.com/gcollazo/884a489a50aec7b53765405f40c6fbd1/raw/49d1568c34090587ac82e80612a9c350108b62c5/sample.json';
fetch(url)
...
0
votes
0
answers
71
views
Is there a way to delve into objects using Node-Fetch API [duplicate]
I've been tasked with a project that requires the use of API. I would love to learn if possible, how to delve into an object using node-fetch API.
I am looking to fetch a list of objects on a page, I ...
2
votes
1
answer
485
views
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 ...
-1
votes
1
answer
854
views
Node-fetch not working like REST client, why?
Trying to use node-fetch and it comes back with an empty response: {"size": 0, "timeout": 0}. This is supposed to be an OAUTH2 Access Token (basically a JWT). What did I do wrong?
...
0
votes
0
answers
7k
views
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 (...
1
vote
0
answers
1k
views
node-fetch invalid header token
this is the code i tried to run but I am constantly getting same error. If I remove cookie from headers it works but I need cookies just like this format."cookie": "username=admin"
...
0
votes
0
answers
168
views
Random characters in and at the end of a Response body (node.js)
I'm having issues with my node-fetch (specifically, node-fetch-cookies library). I'm supposed to get a string returning from a POST request like:
post_enc=...
10
votes
5
answers
9k
views
Is there a way to pipe ReadableStream<Uint8Array> into NextApiResponse?
I'd like to display Google Place Photos in my NextJS application. To GET these images from their specified URL an API key is needed, but at the same time, I do not want to expose this API key to the ...
1
vote
1
answer
2k
views
fetch + big-json - How to return a json stream?
In my app I need to fetch a big json (>600MB) - I'd like to be able to fetch it from my api or from the file on my disk depending on the settings - unfortunately I cannot do JSON.parse because I ...
1
vote
1
answer
2k
views
Node Fetch cannot get header value from headers object
I have some code using the node-fetch API to make an HTTP request. The code is the following:
fetch('/home.html', {
body,
method: 'POST',
headers,
withCredentials: true,
//...
-2
votes
1
answer
961
views
Unable to get authorizationCode from EpicGames API
I've been working on a project which requires to get a deviceAuth code, and requires you to have a valid and logged into Web Browser Epic Games/Fortnite Account to use this endpoint, which I have done,...
1
vote
0
answers
163
views
FetchError: request to https://rf-werf.rdvd.com:3000/v1/locales failed, reason: connect ECONNREFUSED fe80::9030:9b22:8639:bfb3:3000
I am working on one windows application where one layer is built on top of Node.js where we basically calling one language API to get the list of languages.
Earlier when we were using Node v16.14.2, ...
2
votes
1
answer
2k
views
Conditional import with ES Module ( fetch / node-fetch )
I'm writting a JS code that can be use eather for Node application or for JavaScript web browser application.
Since Node 17.5 it's now possible to use the native fetch API from JavaScript.
I wonder if ...
1
vote
0
answers
70
views
GitHub API authorization works with node-fetch v2 but not with v3
I have the following fetch request that works fine with node-fetch v2.6.0:
const url = "https://github.developer.mycompany.io/api/v3/search/code?q=%3Cnxt+extension%3Ats+extension%3Ahtml+repo%...
0
votes
0
answers
87
views
I am getting a response code of 400 or 429
I am working on REST API.
From my end, everything seems to be fine. I've tried multiple libraries (AXIOS, request, fetch) in order to make a PUT call.
However, I keep on getting 429 or 400 as a ...
0
votes
0
answers
105
views
Send cookies with node-fetch to bing
I am trying to fetch bing search results with 50 searches per page. Simply editing the url to include "&count=50" doesn't work, and so I am sending a cookie to update the preference.
...
0
votes
1
answer
2k
views
Typscript cannot import node-fetch
I'm trying to import 'node-fetch'.
import fetch from "node-fetch";
But I seem to get an error.
C:\Users\pat\Documents\GitHub\js\flux\backend\dist\http.js:7
const node_fetch_1 = ...
0
votes
1
answer
1k
views
Node-Fetch unhandled promise rejection (can't catch it)
I'm struggling for 2 days on this one so I try asking here:
I have a nodejs script using node-fetch to make queries ton an API. However, I've tried adding catch blocks everywhere but it seems I didn't ...
0
votes
2
answers
451
views
How to get a certain element from a body?
I use node-fetch , and I get the body of the site this way:
import fetch from 'node-fetch';
(async () => {
const response = await fetch('link');
const body = await response.text().
...
2
votes
2
answers
1k
views
innerText value is undefined when returned from promise despite being there on the console
I'm using Node JS, here's the code
import fetch from 'node-fetch';
import { JSDOM } from 'jsdom';
import {Appartment} from "./models/Appartment.mjs"
let applist = []
let multipleDivs = []
...
1
vote
1
answer
3k
views
Check if a Twitch Stream Is Live Using node js
I don't know how to combine them.
I made a code by referring to the link below.
Please Help me...
Android - Checking if a twitch stream is online
Is There Any Way To Check if a Twitch Stream Is Live ...
0
votes
0
answers
137
views
Can you send multiple fetch post requests simultaneously to avoid rate limits?
Scenario: I have a script that uses node-fetch to GET a list of 200 users from a website, then update a variable for those users with POST to give/remove access to a restricted area. It does this for ...
0
votes
1
answer
883
views
Scraping text on google translate page - Javascript
I'm trying to scrape a few pieces of text from this URL https://translate.google.ca/?sl=en&tl=zh-TW&text=Hello&op=translate
So far I have one piece working, but I can't figure out how to ...
0
votes
2
answers
2k
views
How can I redirect the user to a custom URL scheme with Express.js and node-fetch?
Sorry if my usage of server-related words is wrong, I'm new to this. I have two Express.js servers one on port 3000 and one on port 8000. The browser renders two different HTML files on these two ...
-2
votes
1
answer
3k
views
Why does my response look like this? Node-Fetch
I'm a newbie to Node JS and I'm trying to get the data from this URL: https://www.tiktok.com/node/share/user/@test/
You don't need to sign into anything to look at the data, you can literally click ...
3
votes
2
answers
750
views
Why Jest failing on node-fetch giving syntax error on import
I'm trying to understand how to fix the following error using Jest in my unit tests in NodeJS.
The test run with this command "test": "NODE_ENV=test jest spec/* -i --coverage --...
2
votes
1
answer
4k
views
AWS S3 presigned url upload returns 200 but the file is not in the bucket using NodeJS & node-fetch
These are the relevant dependencies in my package.json:
"dependencies": {
"@aws-sdk/client-s3": "^3.52.0",
"@aws-sdk/node-http-handler": "^3.52.0&...
0
votes
2
answers
2k
views
Making POST request to discord server in nodejs
I am trying to make a post request to the following endpoint:
`https://discord.com/api/v9/invites/${link}`
But, i keep getting the following response:
{
captcha_key: [ 'captcha-required' ],
...
0
votes
0
answers
1k
views
How to use node fetch and express at the same time?
I want to get data from API and show it. I use node-fetch and express. Node-fetch is not supported 'require'. Therefore, I use import fetch from 'node-fetch'. For this, I added "type": &...
2
votes
1
answer
3k
views
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 ...
0
votes
1
answer
995
views
{"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,
...
0
votes
2
answers
559
views
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 ...
0
votes
1
answer
647
views
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 ...
1
vote
1
answer
8k
views
How to get all of the members of a guild with a certain role in discord.js v13
I'm currently working on a discord.js bot to start getting some practice with node.js
I have currently run into a problem when trying to get all the members of a guild with a certain role. Here is the ...
0
votes
1
answer
1k
views
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 ...
1
vote
1
answer
2k
views
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
^^^^^
...
0
votes
1
answer
938
views
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 ...
0
votes
0
answers
123
views
Module import or export statement unexpected here Javascript
I am trying to use node fetch to retrieve a string from a Misty robot and then pass this information to a Lobe ML model for a senior year developmental class.
The problem is that fetch was originally ...
2
votes
1
answer
203
views
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 ...
36
votes
2
answers
17k
views
node-fetch 3.0.0 and jest gives SyntaxError: Cannot use import statement outside a module
I'm trying to upgrade my api to use node-fetch 3.0.0. Part of the breaking changes in their documentation is that node-fetch is now a pure ESM module.
https://github.com/node-fetch/node-fetch/blob/...
2
votes
2
answers
24k
views
TypeError: fetch is not a function, What did I do wrong?
I'm trying to use node-fetch in order to fetch this website that has this JSON file where I can use it for my discord bot.
Code (JS):
const fetch = import("node-fetch")
// some code until
...
0
votes
0
answers
203
views
Js: Can't import object from external file with node-fetch imported
I have some credential saved in a file called secrets.js, in the same folder of the main.js file.
In the secrets.js file I wrote this:
const secrets = {}
secrets.key = "..."
secrets.discord =...