Questions tagged [node-fetch]

462 questions
0
votes
0 answers

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 const url: string; declare cosnt file: { …
Akxe
  • 9,694
  • 3
  • 36
  • 71
0
votes
1 answer

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: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, …
FrostZer0
  • 11
  • 3
0
votes
1 answer

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 if there is one (possibly caching a previous…
NYoung
  • 157
  • 1
  • 14
0
votes
1 answer

curl returns expected result, but node-fetch doesn't

I want to scrapping shopee with…
Giuk Kim
  • 170
  • 10
0
votes
1 answer

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 takes too much time, and the execution get…
m-alptekin
  • 11
  • 5
0
votes
0 answers

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 getting the error,ERR_TLS_CERT_ALTNAME_INVALID . Adding…
0
votes
0 answers

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 device on the robot. While fetching the data from the…
MacGregor
  • 51
  • 4
0
votes
0 answers

Error [ERR_REQUIRE_ESM]: require() of ES Module - Node-Fetch Issue?

I'm getting the above error when I'm running my test. I've spent ages looking at the other similar errors reported on here but I just can't resolve it. I've removed node-fetch and installed node-fetch@2 but I'm still getting the same error. Any…
CForsh75
  • 23
  • 1
  • 5
0
votes
0 answers

Sending an api request with python works, but the exact same request sent from wix velo (javscript) returns a 400 error

I'm working with a REST API that requires authentication. I sent a request from my local machine using python and Got a successful response. When I did the same request using javascript (hosted on Wix Velo) I got a 400 error. I've used a request…
0
votes
0 answers

after GET https://some.com/some prisma.some.findMany() crashed with exit code -1073741819 (0xC0000005)

if // any prisma.some.findMany() // all ok if // any const some = await axios.get('https://some.com/some') // or nestjs/axios or node-fetch console.log(some) // ... console.log('before') prisma.some.findMany() …
0
votes
0 answers

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 = require('node-fetch') /* This code is inside an async method and…
0
votes
1 answer

Getting the error "SyntaxError: Unexpected token u in JSON at position 0" when fetching random posts from a subreddit

When I try to fetch a post from https://www.reddit.com/r/hoodironycentral/random/.json it returns me undefined while JSON.parse is running. Here is my code: import { EmbedBuilder, PermissionsBitField, SlashCommandBuilder } from "discord.js"; import…
Mustafa
  • 3
  • 2
0
votes
0 answers

node-fetch does not return any results on the server side

Hello to all! When I send my request via fetch and corsproxy api in my browser, I get the result without any problem: const url = 'https://corsproxy.io/?' + 'https://exampleurl.com'; const res = await fetch(url); console.log('res', await…
Jack Pate
  • 169
  • 4
  • 15
0
votes
1 answer

'TypeError: Protocol "http:" not supported. Expected "https:"' error when fetching HTTPS site

I'm trying to use node-fetch to capture the contents of a page, and running into an unexpected error. I checked a similar question but it doesn't seem relevant. I am trying to fetch a HTTPS site using an HTTPS agent and agents, but I'm getting an…
garson
  • 1,505
  • 3
  • 22
  • 56
0
votes
1 answer

script type="module" not console.log anything? in node-fetch

I am Using node-fetch for some reason, I do it on simple HTMl and js not npm install. I want to use it with cdn. below attachments, I used this approach and not logging anything. In html In…