Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    John Doe
    oook :)
    what do you want to upload ?
    Nicolai Kamenzky
    @pulkitsinghal Hey old pal, how are you doing? Have a look at the README. At the bottom there are all changes with the breaking changes being marked. At the top there are even migration steps you might need to take.
    Nicolai Kamenzky
    @andreasvirkus Have a look at the details about forms in the request README. Btw, all request options work for request-promise as well. Usually, you don’t have to set the header yourself. It’s set automatically when you e.g. use the formData option.
    Pulkit Singhal
    @analog-nico - you're right! i got distracted with the notes on top and didn't scroll down far enough to see the details at the bottom. Thanks for pointing that out!!!
    The curl equivalent of what I'm trying to accomplish is this:
    curl -X POST http://localhost:8080/api/v1/upload -H “authorization:here goes token"
      --header "Content-type: multipart/mixed"  -F "imageFile=@TestImage.jpg”
      -F "imageFile=@TestImage2.jpg" -F "applicationNumber=SL-ESA-17000322"   -F "personalId=12345678A"
    @analog-nico I can't use multipart/form-data unfortunately : /

    If I try and send my images as base64:

    const formData = {
        imageFile: files.map(file => new Buffer(fs.readFileSync(file.path)).toString('base64')),

    then I get an error write after end

    Correction, the error I get is about the request being sent with contentType multipart/form-data:
    415 - "{\"timestamp\":1506930784462,\"status\":415,\"error\":
    \"Unsupported Media Type\",\"exception\":\"org.springframework.web.HttpMediaTypeNotSupportedException\",
    \"message\":\"Content type 'multipart/form-data;boundary=--------------------------732586446978103238773917' not supported\",
    any help greatly appreciated!
    Any help?
    For any future lurkers, I figured it out. Ended up with this code:
    const formData = {
    const multipart = files.map(file => ({
        'content-type': 'multipart/mixed',
        body: fs.createReadStream(file.path),
    return rest.post({
        postambleCRLF: true,
        uri: Configuration.getIdentificationServiceUrl() + '/api/v1/upload',
        headers: {
            'Content-type': 'multipart/mixed',
            'Authorization': token,
        qs: formData,
    Has anyone heard of issues of promises losing their way when a request is sent to a proxy
    Hi all, I'm looking to use request-promise to send multiple messages to facebook (https://graph.facebook.com/v2.6/me/messages) in sequence. Could someone help out - although having read-up on simple promises, I'm not sure about chaining and catching errors.
    Velin Georgiev
    Hi all, does request-promise-native support sending requests behind corporate proxy?
    Dan Stein
    Hey, im getting unhandled rejection errors from request-promise
    but as far as im aware my .then chain is correct
    charlie kurban


    I have request promise version 2.83.0
    When I make a api call to the backend via request-promise then I am getting below written timeout error BUT when I make same call via POSTMAN then it works fine. Seems to be error is down to the request-promise.

    { RequestError: Error: connect ETIMEDOUT
    at new RequestError (/Users/xxx/dev/yyyy/node_modules/request-promise-core/lib/errors.js:14:15)
    at Request.plumbing.callback (/Users/xxx/dev/yyyy/node_modules/request-promise-core/lib/plumbing.js:87:29)
    at Request.RP$callback [as _callback] (/Users/xxx/dev/yyyy/node_modules/request-promise-core/lib/plumbing.js:46:31)
    at self.callback (/Users/xxx/dev/yyyy/node_modules/request/request.js:186:22)
    at Request.emit (events.js:127:13)
    at Request.emit (domain.js:421:20)
    at Request.onRequestError (/Users/xxx/dev/yyyy/node_modules/request/request.js:878:8)
    at ClientRequest.emit (events.js:132:15)
    at ClientRequest.emit (domain.js:421:20)
    at TLSSocket.socketErrorListener (_http_client.js:394:9)
    at TLSSocket.emit (events.js:127:13)
    at TLSSocket.emit (domain.js:421:20)
    at emitErrorNT (internal/streams/destroy.js:64:8)
    at process._tickCallback (internal/process/next_tick.js:114:19)
    Hi, I want to use request-promise for fetching prices from a supplier site. My main concern is i need to log in before accessing all the prices
    So i have to maintain session after the login
    I tried to include cookies in each request with let j = request.jar()then adding jar : jin options of each request but it apparently doesn't works... Anyone has an idea of how to achieve that?
    what option I need to set for CA validation?
    for request-promise-native
    I'm using request-promise with a bearer token. I get back a "StatusCodeError: 404 - undefined" error. The same uri I'm using works in Postman. Do any of you know why I'm getting a 404 error?
    Daniel Payne
    im having a mem leak with the new tough cookie filling up the heap
    (node:19286) UnhandledPromiseRejectionWarning: StatusCodeError: 400 - {"error":{"message":"INVALID_PARAMETERS"}}
    .. I am having this error on my terminal while tryin to get a request and i have handled the promise well i think.. here it is.... createInvoices: (whose, payload) => {
    return new Promise((resolve, reject) => {
    .then(token => {
    var options = {
    url: config.api.invoices,
    method: "POST",
    json: true,
    headers: {
    authorization: Bearer ${token}
    body: payload
    rp(options).then(crtdinvoice => {
    // resolve(data)
                }) .catch(err => {
    Nicolai Kamenzky
    I think you are missing the catch for the promise returned by self.login(...)
    Lucas Kohorst

    Hi guys I am working on using react and corenlp for a project. corenlp depends on request-promise-native. When I start my react app I get an error ./node_modules/corenlp/dist/connector/connector-serer.js Module not found: Can't resolve 'request-promise-native'

    Even though I have request-promise-native in my package.json

    Hey, had a quick question
    when running mocha from CLI, all of the request-promise promises are logging out; its super annoying
    any way to suppress the logs?
    i understand it's a bit out of context question
    hello guys, i'm trying to upgrade my code and put a kind of tracker, like i'll receive de coord and use with API google maps, but this is happening
    let requestPromise = require ("request-promise"), this is de code that is doing this error
    Mohammed Yassine CHRAIBI

    Hi guys !
    I am having quite a problem here (js beginner here)
    I wrote this piece of code (reduced for simplicity) and I cannot get the html from each promise

    const rp = require('request-promise');
    for (__) {
    .then(html => {
    // Get ids from html
    const $ = cheerio.load(html);
    .then(ids => {
    // Store the ids in array and return the promises
    return Promise.all(ids.map(id => request({
    uri: JOB_URL + id,
    resolveWithFullResponse: true
    .then(jobs => {
    // Grab information
    // I cannot load the html since an object is returned
    // I assume all promises are resolved since there are no errors
    jobs.forEach(job => {
    // ....
    .catch((error) => {

    Basically I load the first page from which I get IDs, store them in the array and use it to send one request per element in the array. I don't however have access to the returned html, I get an object instead.
    Help? Anyone?
    Thanks !

    Mohammed Yassine CHRAIBI
    @Gabriellog did you run npm install?
    if you did, delete node_modules folder and re-run it, I think that should do it
    hi @analog-nico currently i am using request-promise in Google cloud function for post API call but getting the error "RequestError: Error: getaddrinfo EAI_AGAIN". Am sending the Authorization in header as well.
    function sendData() {
    console.log("*sendData **");
    var options = {
    method: 'POST',
    uri: 'https://xxxxx/oauth/token?grant_type=client_credentials',
    headers: {
    'Authorization': 'Basic dfdSOU1TOER1LVI3ejdpdfddlck9tOm1sUGQxdHBTdGFaSmJpcU1USHRsdTVVQ1dVRU8tQ0Rl'
    json: true
        .then((parsedBody) => {
        console.log("***********printing response************");
        .catch((err) => {
          console.log("error caughttt :"+err);
    sorry i am masking the url. Can you help me why authorization is not taking even though i am setting in headers
    i am trying with different options from Google cloud with axios, async axios as well, authorization is not considering. Trying with request-promise as well. Any idea what could be the issue
    even i have declared - const rp = require('request-promise');
    @analog-nico any suggestions for the error which is happening only in google cloud platform
    Amar DK
    Hello Guyz Please Help I AM Facing Issue In Promise Return
    When I Return Promise Data
    console.log("Checking Locally Error", promiseData)
    It is Showing Like This Checking Locally Error====> Promise {
    {data:1, name:"xyz"},
    I Want to get promiseData[0].data and promiseData[1].data
    How to retrive please any1 Help Me Please Guyz.
    Rakan Khirbik
    Hello, request/request-promise supports google-protobuf requests/responses?
    I am trying to hit a graphql end point with below code,it gives me a 403 error,i can access the endpoint through postman properly . Note i am using the bearer token directly in the request.
    StatusCodeError: 403 - "<html>\r\n<head><title>403 Forbidden</title></head>\r\n<body>\r\n<center><h1>403 Forbidden</h1></center>\r\n<hr><center>nginx/1.17.6</center>\r\n</body>\r\n</html>\r\n"
    at new StatusCodeError (node_modules/request-promise-core/lib/errors.js:32:15)
    at Request.plumbing.callback (node_modules/request-promise-core/lib/plumbing.js:104:33)
    at Request.RP$callback [as _callback] (node_modules/request-promise-core/lib/plumbing.js:46:31)
    at Request.self.callback (node_modules/request/request.js:185:22)
    at Request.<anonymous> (node_modules/request/request.js:1154:10)
    at IncomingMessage.<anonymous> (node_modules/request/request.js:1076:12)
    var options = {
    method: 'POST',
    json: true,
    headers: {
    'User-Agent': 'Request-Promise',
    "Authorization": Bearer ${authToken},
    "Content-Type": 'application/json',
    "Accept": '/',
        const res = await rp({uri:API,options,"rejectUnauthorized": false})