Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    John Doe
    @peculiarity
    when I get to NODE repl and inject my dist file
    TypeError: global.XMLHttpRequest is not a constructor
    This happens when I require my bundle ( using webpack)
    any ideas?
    John Doe
    @peculiarity
    ok I fixed that issue .. got new one ..
    andreas
    @andreasvirkus
    Hi all. I'm having issues setting my content-type header for a request containing files.
    .then(token => {
        return rest.post({
            uri: '/api/v1/upload',
            headers: {
                'Authorization': token,
                'content-type': 'multipart/mixed',
            },
            formData: formData
        });
    })
    the request still shows the value multipart/form-data
    am I setting the header wrong somehow?
    John Doe
    @peculiarity
    oook :)
    what do you want to upload ?
    Nicolai Kamenzky
    @analog-nico
    @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
    @analog-nico
    @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
    @pulkitsinghal
    @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!!!
    andreas
    @andreasvirkus
    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 : /
    andreas
    @andreasvirkus

    If I try and send my images as base64:

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

    then I get an error write after end

    andreas
    @andreasvirkus
    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\",
    \"path\":\"/api/v1/upload\"}"
    any help greatly appreciated!
    andreas
    @andreasvirkus
    Any help?
    andreas
    @andreasvirkus
    For any future lurkers, I figured it out. Ended up with this code:
    const formData = {
        applicationNumber,
        personalId,
    };
    
    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,
        },
        multipart,
        qs: formData,
    });
    johnathandinh
    @johnathandinh
    Hello!
    Has anyone heard of issues of promises losing their way when a request is sent to a proxy
    manapausejp
    @manapausejp
    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
    @VelinGeorgiev
    Hi all, does request-promise-native support sending requests behind corporate proxy?
    Dan Stein
    @happy-machine
    Hey, im getting unhandled rejection errors from request-promise
    but as far as im aware my .then chain is correct
    charlie kurban
    @charliekurban_twitter

    Hi

    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 54.229.253.90:443
    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)
    duizabojul
    @duizabojul
    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?
    Pritam
    @pritamsarkar007
    what option I need to set for CA validation?
    for request-promise-native
    klyn12
    @klyn12
    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
    @dpayne_ytel_gitlab
    hey
    im having a mem leak with the new tough cookie filling up the heap
    4.2.2
    kaleabmelese
    @kaleabmelese
    (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) => {
    self.login(whose)
    .then(token => {
    var options = {
    url: config.api.invoices,
    method: "POST",
    json: true,
    headers: {
    authorization: Bearer ${token}
    },
    body: payload
    }
    rp(options).then(crtdinvoice => {
    console.log(crtdinvoice);
    // resolve(data)
                    })
                }) .catch(err => {
                    reject(err)
                })
    
        })
    }
    Nicolai Kamenzky
    @analog-nico
    I think you are missing the catch for the promise returned by self.login(...)
    Lucas Kohorst
    @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

    tophercf
    @tophercf
    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
    Gabriellog
    @Gabriellog
    image.png
    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
    @yassine5505

    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 (__) {
    rp(url)
    .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) => {
    console.log(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
    @yassine5505
    @Gabriellog did you run npm install?
    if you did, delete node_modules folder and re-run it, I think that should do it
    NiranjaniDN
    @NiranjaniDN
    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
    };
      rp(options)
        .then((parsedBody) => {
        console.log("***********printing response************");
          console.log(parsedBody);
        })
        .catch((err) => {
          console.log("error caughttt :"+err);
        });
    }