All Questions
Tagged with node-fetch node.js
363 questions
0
votes
1
answer
164
views
teams toolkit deploy failed with node-fetch
I have created a new app using VSCode teams tools kit v5.8.1
The app is the bot application connected to Function app
when I start debugging by clinking both debug in teams and debug in test tools
I ...
0
votes
0
answers
128
views
Node.js Fetch Error: getaddrinfo ENOTFOUND
I'm encountering a DNS resolution error when trying to fetch data from Unsplash using Node.js. Here are the details of my setup and the error message I'm seeing:
const fetch = require('node-fetch');
...
0
votes
1
answer
30
views
Jest, typeOfEnv is node, polyfill with node-fetch, complains about require() when clearly using import
Node v16.20.2
package.json:
{
"private": true,
"name": "baffled-i-tell-you",
"version": "0.1.0",
"main": "index.js",
&...
0
votes
0
answers
94
views
Can I tunnel HTTPS requests through a Node.js proxy server, using node-fetch without extra modules?
I have a HTTP proxy server like so
ProxyServer = http.createServer((request, response) => {
console.log("connection established");
console.log("request", request);
res....
0
votes
0
answers
295
views
globalThis.fetch resolves to node-fetch (an indirect dependency) in a next.js project using pnpm
import ky from 'ky'
import { NextApiRequest, NextApiResponse } from 'next'
export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
await ky.get("https://google....
0
votes
0
answers
502
views
Fetch failed on Docker, but works fine locally
I have the following simple Node app:
import dotenv from "dotenv";
import { Client, GatewayIntentBits } from "discord.js";
dotenv.config();
const client = new Client({
...
0
votes
0
answers
100
views
node-fetch hangs with uploading files using FormData
I'm stuck with the seemingly simple task of posting a file via FormData using node-fetch.
The code below does work with tiny files (~1.5 KB). With slightly bigger files (i.e. >= ~69 KB), it prints ...
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
0
answers
97
views
504 gateway error after node-fetch migration from request library
This is Javascript
const fetch = require("node-fetch").default;
let iApi = express.Router();
iApi.post("/update/:name/:value", async (req, res) => ...
0
votes
1
answer
728
views
node-fetch and axios GET call hangs forever
I have this small node-typescript project that gets a bunch of links from shops like ikea, homedepot and amazon from google sheets, makes fetch calls to get some information from a product, and then ...
-3
votes
2
answers
278
views
Why is my GET Request getting hung up in Node using Fetch [closed]
getDocuments request never completes/stays pending. What am I missing?
App.js
import React, { useState, useEffect } from 'react';
import Grid from './Grid';
import apis from '../api/index';
export ...
0
votes
1
answer
1k
views
How do I use a specific TLS version with `node-fetch` like TLS v1.2?
I'm getting a 403 FORBIDDEN error and need to set the TLS version to TLS v1.2 with fetch calls using the node-fetch library. How do I do that?
1
vote
1
answer
562
views
"Can't resolve 'encoding'" warning in NextJS caused by try/require from `node_modules`
In a NextJS 13.4.19 app in typescript, using @apollo/[email protected] causes a warning at the build step, coming from ApolloServer/node-fetch. This seems caused by a try / require in node-fetch:
./...
0
votes
1
answer
699
views
Node.js http/node-fetch ETIMEDOUT no longer works
I'm writing an API in Node.JS to protect my API keys for a basic weather app SPA.
Initially my http requests got through fine. The next day (today), with no changes to the request, it fails and I am ...
0
votes
0
answers
667
views
When I introduced node-fetch in my codebase I get 'import_node_fs.promises' as it is undefined
I am working on a Vite project with React and I am trying to make a request with node-fetch. I have installed the dependency as described in the docs but I am getting this logs on browser console.(...
2
votes
1
answer
2k
views
Node.JS 18.16.1 -> Fetcherror: Unsafe Legacy Renegotiation
I am getting following error when trying to make an API call to the vendor server.
The issue I am facing is my code works when using node version 16 and following error is encountered when using node ...
1
vote
0
answers
75
views
uploading using form-data a remote file
in my node application I want to use FormData to upload a remote image.
To do this I'm trying the following
const form = new FormData();
...
const result = await fetch(image);
form.append(&...
1
vote
1
answer
1k
views
How to fix the ECONNREFUSED NodeJS( + NEST ) error when making fetch request in a dockerized node server?
I am trying to make a fetch request using a dockerized NodeJS( + nest framework ) (version 16.20.0) server.
The docker image contains a strapi container running on http://localhost:1337/ and ...
0
votes
3
answers
979
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 ...
1
vote
1
answer
555
views
Accessing zabbix API with node-fetch
I am trying to access Zabbix API from a Node.js app with the following code:
fetch(
"http://localhost:8080/api_jsonrpc.php",
{
method: "POST",
headers: {
"...
1
vote
0
answers
567
views
Transform FS createReadStream to native ReadableStream (for native NodeJS fetch)
This script is how I always uploaded files to server, but I would like to remove dependecy on node-fetch library and it has confilicting types of streams.
import {createReadStream} from 'fs';
declare ...
0
votes
1
answer
49
views
Cannot read properties of undefined (reading 'length') discord.js
Attached below is my code. It works the first time it is run but not the second time.
const { Client, GatewayIntentBits } = require('discord.js')
const client = new Client({
intents: [...
1
vote
1
answer
677
views
Why does this API request return different things with node-fetch than with node's inbuilt fetch?
I have a node app which sends an api request to trigger a bet on Manifold (a fake betting site).
When I use node-fetch it makes a bet.
When I use the inbuilt fetch it returns an old version of the bet ...
8
votes
0
answers
4k
views
Webpack configuration with node-fetch is giving "node:buffer" is not handled by plugins
I am trying to implement node-fetch with a react app and Webpack setup. But on using the node-fetch. I am getting tons of errors.
ERROR in node:buffer
Module build failed: UnhandledSchemeError: ...
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 ...
1
vote
1
answer
948
views
curl returns expected result, but node-fetch doesn't
I want to scrapping shopee with node-js
ex)https://shopee.co.th/Erb-Eastern-treat-Body-Oil-240-ml.-%E0%B8%AD%E0%B8%AD%E0%B8%A2%E0%B8%A5%E0%B9%8C%E0%B8%97%E0%B8%B2%E0%B8%9C%E0%B8%B4%E0%B8%A7-%E0%B8%81%...
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
236
views
Getting ERR_TLS_CERT_ALTNAME_INVALID error
import {Router} from 'express'
import fetch from 'node-fetch'
const tasks=Router()
tasks.get('/', async (req,res) => {
const response= fetch('https://dummy-api')
res.json(response)
})
I am ...
0
votes
0
answers
79
views
Fetching characters with node-fetch
I am writing a browser application in ReactJS that should manipulate and display data from robot Wifibot Lab. It sends me 21 chars from which every one of them stands for the status of different ...
1
vote
0
answers
117
views
How to login to a Spring login form using node-fetch
I have access to a Spring application via a username and password from my browser and I want to login from a NodeJS application.
I followed the post (How to login to a spring security login form using ...
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 = ...
0
votes
1
answer
45
views
Preserving data in a fetch request in node js
Oilà,
I'm a beginner with nodejs and I am using it to create a telegram bot. This is my code:
const Geolocation = (req) => {
var address = "15 Freedom Way, Jersey City, NJ 07305, ...
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
1
answer
1k
views
How to send a message to a Discord webhook in node.js?
I have tried the code posted in this answer (with some modification), but it tells me that fetch is not a function.
const fetch = import("node-fetch");
fetch(process.env.WEBHOOK, {
'method'...
1
vote
2
answers
578
views
PayPal-Mock-Response not working (nodejs, paypal negative testing)
I'm working on the code to cover negative scenarios like card declined and similar.
According to the documentation the only way to do it for Orders is to use the header PayPal-Mock-Response https://...
1
vote
1
answer
457
views
Using web scraping to recive all Twitter followers
I want to create giveaways which require the participants to follow the twitter account of the giveaway creator.
My first idea was to use the Twitter API (endpoint: "/2/users/:id/followers")....
0
votes
1
answer
73
views
cannot get the json body of the request
Trying to get the body of the body using fetch and with the authentication of adobe. I always get this 200 response (means okay) but I cannot the actual response of body like in postman.
[Symbol(...
0
votes
0
answers
16
views
Data fecthing in MySQL vith Node js
I was used to python and migrated to nodejs in backend development
The extensions node-fetch and mysql are pretty similar in Docs I've been reading
I am so trying to store in a variable the rows I ...
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
484
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
vote
0
answers
515
views
Is there is any solution to show output of node JS in vs code terminal
I am a new learner of nodejs. I am using VScode for node Js file. The output of the file is shown in the node JS terminal, But for my convenience, I want to do it in the VScode terminal. when I wrote ...
-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
1
answer
375
views
node-fetch connect ECONNREFUSED for fetching my api on vps server
I have been working on a NodeJS express app that uses EJS and node-fetch to fetch my Api from my vps server, but it won't get fetched, every page of the app will load but the page that uses the Api ...
0
votes
0
answers
787
views
Copied browser request as Node fetch via dev tools is not working
Chrome devtools has a feature that allows to copy a request in the browser as node-fetch
But for some reason if I try to run this request in node it returns:
status: 403,
statusText: 'Forbidden'
I ...
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=...