Questions tagged [request-promise]

NodeJS simplified HTTP request client 'request' with Promise support. Powered by Bluebird.

NodeJS simplified HTTP request client 'request' with Promise support. Powered by Bluebird.

Resources

Also check out the new libraries that are very similar to request-promise v4:

363 questions
2
votes
1 answer

Unhandled rejection error: StatusCodeError: 401 (Unauthorized: Access is denied due to invalid credentials)

This page shows JSON inside plain empty html/body tags. For example: **JSON DATA *** I can access that page fine doing it normally within a browser. But, when I send a request it says that my credentials are…
Chris
  • 973
  • 1
  • 8
  • 20
2
votes
1 answer

How can I intercept all node request-promise http requests to modify the request options?

I would like to create a global request interceptor for request-promise based requests so that I can add an x-request-id header to all outgoing requests. Since the behaviour is common across all outgoing requests, I prefer to not have to add this…
Richard Collette
  • 5,462
  • 4
  • 53
  • 79
2
votes
1 answer

How to debug request-promise which fail with ETIMEDOUT

I'm running Debian 6 with NodeJS6 and request-promise. I'm using request-promise to deliver web hooks. Currently, we are delivering around 2+M web hooks each day. Most of the time everything runs fine, but there are cases where the HTTP request…
Michael Nielsen
  • 1,194
  • 3
  • 22
  • 37
1
vote
0 answers

TypeError: Failed to fetch in React using Fetch API

I using React and I am creating an application that integrates the backend as well. I am trying to fetch data from my backend. I have started both the frontend and the backend, and, using Thunderclient, checked that the endpoint is working fine. But…
Jesmine
  • 9
  • 3
1
vote
1 answer

Node.js how to .then after declaring a variable as a function that has a promise inside

I am attempting to set a variable scannedCode to a scanned qr code result. However, the steps after that happens continues even before scannedCode is in use, due to the promises. How can I make it so nothing continues until the variable finishes and…
1
vote
0 answers

Discord.js TypeError: Cannot read properties of undefined (reading 'messages')

I'm coding a discord bot and I've coded a function that fetches messages from a channel on discord, but the bot can't read messages. I couldn't solve the problem, can anyone help me? Error Stack: An error occurred while trying to fetch the…
Klein
  • 11
  • 2
1
vote
0 answers

send multiple ajax post requests at regular intervals until any one of them passed

I am writing a test program for website most of time the website gives 504 error. i want to write a program that can sent ajax requests to server and replace page with server response html. the process of requests is like : send 20 requests at a…
1
vote
0 answers

mssql execute: return both promise and recordsets

I am using node-mssql to perform a bunch of operations inside a transaction. Spcifically, the methods used in order are begin tran,bulk,bulk,exec,commit. Here is part of the code, which works as-is: // bulk insert #columns .then(result => { …
George Menoutis
  • 6,894
  • 3
  • 19
  • 43
1
vote
0 answers

How to get pm2 logs as json by exec function?

I'm enclosing my code so you can understand my intent, I want to get the last x lines of logs into res.data in my 'pm2exec' function. I run the server by the command 'pm2 start...' in the terminal and then commit an API request. private…
Omri Hadadi
  • 21
  • 1
  • 3
1
vote
1 answer

NodeJS stream returns incomplete response

I am using lento (Streaming Node.js client for Presto, the "Distributed SQL Query Engine for Big Data") for querying database. Lento's createRowStream takes sql query as a string or Buffer and returns a readable stream that yields rows. Before…
s.k
  • 193
  • 1
  • 2
  • 15
1
vote
0 answers

How to mock 'get' method of 'request-promise' module in typescript?

I import 'get' in the following way: import { get } from 'request-promise';
zfyseu
  • 31
  • 1
  • 7
1
vote
1 answer

Request to opensea api failing

Im trying to retrieve a collection through opensea's graphql api using request-promise. Im sending a request with these params and in response i keep receiving status code 403. I've copied the params directly from the browser where it works fine…
vcosiekx
  • 65
  • 2
  • 9
1
vote
2 answers

unit testing for a nested async call in javascript

I have two methods: second one is called by the first and I have to write test for the first one. function func1(props, num) { num.value +=1; func2(props, num); } function func2(props, num) { props.actions.getItDone().then((res) =>…
1
vote
1 answer

How to return the data which receive from Axios in Object form

const Request = axios.create({ baseURL: 'https://ptx.transportdata.tw/MOTC/v2/' }); export const ScenicSpotRequest = async () => Request.get('Tourism/ScenicSpot? $top=30&$format=JSON').then(response => response.data); export async function…
1
vote
1 answer

Too many simultaneous requests with NodeJS+request-promise

I have NodeJS project with a BIG array (about 9000 elements) containing URLs. Those URLs are going to be requested using the request-promise package. However, 9000 concurrent GET requests to the same website from the same client is neither liked by…