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
18
votes
3 answers

request-promise download pdf file

I received multiple pdf files and must download it from a REST-API. After auth and connect I try to download the file with request-promise: const optionsStart = { uri: url, method: 'GET', headers: { 'X-TOKEN': authToken, …
Ckappo
  • 607
  • 1
  • 9
  • 27
17
votes
2 answers

Async Await map not awaiting async function to complete inside map function before mapping next item

I have an array that I am mapping, inside the map function I am calling an asynchronous function, that is performing an asynchronous request returning a promise using request-promise. I am expecting the first item of the array be mapped, perform the…
mcclosa
  • 943
  • 7
  • 29
  • 59
14
votes
2 answers

Using Async await in react component

So I've created a component that shoots off post requests with props that I provide. Although I'm familiar with Async await I for some reason can't seem to get this to return the actual value of the fulfilled promise and instead just get…
Scottt
  • 165
  • 1
  • 1
  • 5
13
votes
4 answers

Alternatives to request-promise-native

I was looking for modern modules that implement basic HTTP methods such as GET, POST in Node.js. I guess the most popular is request. The async/await version of it is called request-promise-native. Recently I learned that these modules are being…
Sergey Avdeev
  • 910
  • 1
  • 8
  • 16
13
votes
2 answers

Nodejs Request Promise How to display status code

I am using the request library to make external api calls. https://github.com/request/request. I am using the native promise/async extention. https://github.com/request/request-promise-native. However I am not able to check the status code, it is…
Kay
  • 17,906
  • 63
  • 162
  • 270
11
votes
3 answers

Request-Promise throws "no auth mechanism defined" using async/await

I was just trying out async/await with request-promise and ran into this error: RequestError: Error: no auth mechanism defined at new RequestError (node_modules/request-promise-core/lib/errors.js:14:15) at Request.plumbing.callback…
spicypumpkin
  • 1,209
  • 2
  • 10
  • 21
10
votes
2 answers

Why is the Promise reject() in my jest.mock going to a then() rather than a catch()?

I have two files, getItemInfo.js to make API calls and getItemInfo.test.js which is the respective Jest test file. On the test file, I am mocking the http calling triggered by node module request-promise. The question is on the second code block,…
8
votes
3 answers

Nodejs async / await with delay

I have a problem with this code: var request = require('request-promise'); class Test{ constructor(){ } async Start(){ var response = await this.getResponse(); await console.log(response); } async getResponse(){ var options = { …
S.Testersen
  • 93
  • 1
  • 1
  • 5
8
votes
1 answer

TypeError: str.trim is not a function (Request-Promise/Tough-Cookie)

I am having similar problem as discussed here: https://github.com/request/request-promise/issues/183 I am using Request-Promise@4.2.2 and Tough-Cookie@2.3.4 And getting the same error: TypeError: str.trim is not a function I also played around…
7
votes
3 answers

Firebase Cloud Functions: Requests from referer are blocked. - PERMISSION_DENIED

I am not sure why the following code is throwing google api key permission denied. I have the api or service enabled both in firebase console and google console. export async function createJobDynamicLink(job){ if(job.jobStatus !== 'approved' ||…
LearnToday
  • 2,762
  • 9
  • 38
  • 67
7
votes
4 answers

Node.js - Working with an API limit of 5 requests per second

I've got a 'script' that does thousands of requests to a specific API. This API will only allow 5 requests per second (and probably it measures differently then me). To make the requests I'm using request-promise framework, and I've superseded the…
Jono
  • 3,393
  • 6
  • 33
  • 48
5
votes
0 answers

request-promise: set timeout for long requests

I am using request-promise library and trying to set the timeout as milliseconds as per their documentation. I have few requests on the server side that take more than a minute to response, no matter what value I set for timeout, the request always…
Prasanna
  • 3,703
  • 9
  • 46
  • 74
5
votes
5 answers

Handling Js promise rejection

How do you handle an error (eg. "new error" below) that is outside of the promise? function testError() { throw new Error("new error") // how to handle this? var p123 = new Promise(function(resolve, reject) { resolve(123) }); …
Stanley
  • 2,798
  • 5
  • 22
  • 44
4
votes
0 answers

SSL Error When Connecting to HTTPS URL Using Node.js Request-Promise Library

const rp = require('request-promise'); const https = require('https'); const agentOptions = { host: 'localhost', port: 443, path: '/', rejectUnauthorized: false, …
Dessa
  • 237
  • 3
  • 13
4
votes
1 answer

Node.js script request using HTTP Range header is resulting in more bytes than requested.

I am attempting to write a Node.js script that takes in a URL (to download a file) specified through the command line. Using the HTTP Range request header the script downloads the file in a configurable number of chunks and chunk size and then…
TXRedking
  • 76
  • 1
  • 6
1
2 3
24 25