Questions tagged [node-fetch]

462 questions
-1
votes
1 answer

Restart Async Function After Aborting API Fetch

I am creating a Node.js module that takes a list of movie titles and fetches their respective metadata from omdbapi.com. These lists are often very large and sometimes (with my current slow internet connection) the connection stalls due to too many…
rootr
  • 382
  • 1
  • 11
-2
votes
1 answer

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 fetch("MYURL", { "headers": { …
user1592380
  • 34,265
  • 92
  • 284
  • 515
-2
votes
1 answer

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, but if I go DIRECTLY to the API in the Browser,…
Johnty
  • 246
  • 1
  • 2
  • 18
-2
votes
1 answer

nodejs fetch does not return url data

I'm trying to get the json that the url returns. But with this call it returns a response without the data and a status of 200 url: https://www.instagram.com/explore/tags/jeep/?a=1 Code: const express = require("express"); const fetch =…
Gabriel Edu
  • 628
  • 3
  • 11
-2
votes
1 answer

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 the link and you see the data I want to access.…
quiving
  • 23
  • 4
-2
votes
1 answer

How to send three data objects at once in node-fetch

I am making a small node-fetch app that sends usernames to an API. My code works but what I want to achieve is to send three objects with one call, but I am not sure how to do that. I tried adding three objects, separated with a comma, but that…
codePanda
  • 21
  • 2
-2
votes
1 answer

why does my code in nodejs gives error and asks me to write catch but i have already said it in the code

So this is the error (node:24077) UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'id' of undefined at Client.msg (/app/bot.js:18:22) at Client.emit (events.js:196:13) at MessageCreateAction.handle…
-2
votes
2 answers

How to pass data between promise asynchronously?

I want to fetch from the backend several data and process them at the end when they're loaded. Right now, when this code runs, data1 and data2 are undefined. I want to wait for them but I don't know how to keep my code clean. I'm not sure…
Olivier D'Ancona
  • 779
  • 2
  • 14
  • 30
-2
votes
1 answer

I try to get info from slack and fetch the data with node-fetch

This is the data i want to make my bot able to fetch. I'm not really good and quite new to the whole node-fetch thing. This is the code i tried to use, however the "joke" it only returns undefined. let url = "https://icanhazdadjoke.com/slack"; …
Andresen
  • 29
  • 2
-3
votes
1 answer

UnhandledPromiseRejectionWarning: FetchError: invalid json response body at

Error im getting: UnhandledPromiseRejectionWarning: FetchError: invalid json response body at {url} reason: Unexpected token < in JSON at position 0 my code: const fetch = require('node-fetch'); const url = 'Reeeealy long url here'; fetch(url) …
Pleklo
  • 126
  • 1
  • 2
  • 10
-4
votes
1 answer

How do I fetch a webpage with node-fetch?

The following code: import fetch from 'node-fetch' ;(async function fn() { const response = await fetch('https://learnitmyway.com/learning-material-software-development/') const data = await response.json() console.log({ data }) })() results…
David
  • 4,191
  • 2
  • 31
  • 40
-4
votes
1 answer

Understanding how to use Node.JS fetch

I am getting my hands on Node.JS fetch to understand how it works and then use it. I have installed node-fetch and followed some tutorials and saw some videos on the subject, but it is not yet all clear. Even if what is shown works, I still have…
Michel
  • 10,303
  • 17
  • 82
  • 179
1 2 3
30
31