Get request in openshift node js app

Nucktrooper

I'm building an openshift node js app which has to communicate with youtube data API. Its deployment is a success when I do "git push" with the require commented.

    /*
    var request = require('request');
    */

When I uncomment it, I get this error :

remote: Waiting for application port (8080) become available ...
remote: Application 'eln' failed to start (port 8080 not available)
remote: -------------------------
remote: Git Post-Receive Result: failure
remote: Activation status: failure
remote: Activation failed for the following gears:
remote: 573c3e177628e146d400004e (Error activating gear: CLIENT_ERROR: Failed to execute: 'control start' for /var/lib/openshift/573c3e177628e146d400004e/nodejs

Am I doing it bad? How can I fix it?

thank you.

Edit 1: Adding listening code, I didn't modify it (it was already here when I've created the app).

    self.ipaddress = process.env.OPENSHIFT_NODEJS_IP;
    self.port      = process.env.OPENSHIFT_NODEJS_PORT || 8080;

    /**
     *  Start the server (starts up the sample application).
     */
    self.start = function()
    {
        //  Start the app on the specific interface (and port).
        self.app.listen(self.port, self.ipaddress, function()
        {
            console.log('%s: Node server started on %s:%d ...', Date(Date.now() ), self.ipaddress, self.port);
        });
    };
jakob

This is my app.js basic code that is working on openshift.

#!/bin/env node

ipaddress = process.env.OPENSHIFT_NODEJS_IP;

if (typeof ipaddress === "undefined") {
    //  Log errors on OpenShift but continue w/ 127.0.0.1 - this
    //  allows us to run/test the app locally.
    console.warn('No OPENSHIFT_NODEJS_IP var, using 127.0.0.1');
    ipaddress = "127.0.0.1";
};

var server = app.listen(8080, ipaddress, function() {
  console.log('Listening on port %d', server.address().port);
});

Can you try that?

Update

After trying it on openshift with request I also got this error but it was because package.json didn't have request under dependencies.

My dependencies now look like this and it works fine:

  "dependencies": {
    "ejs": "^2.4.1",
    "express": "~3.4.4",
    "request": "latest" // this is added
  },

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Node.js app on openshift

From Dev

Empty request body with POST using CORS with a node app on OpenShift

From Dev

Error while connecting to mysql database in openshift via node js app

From Dev

Error while connecting to mysql database in openshift via node js app

From Dev

Openshift Node.js app serves javascript but not css

From Dev

Determine if Request is Local in Node.js app

From Dev

Openshift node app failed to start

From Dev

Node js request get page error 500

From Dev

Node.js: get path from the request

From Dev

Simple get request with node.js and express

From Dev

Node.js https get request ECONNRESET

From Dev

use GET method in node js request?

From Dev

Chaining GET request with a response Node.js

From Dev

HTTP GET request with parameters Node.js

From Dev

get request object array in node.js

From Dev

Perform Get request with body - Node js

From Dev

Node.js Deployment in openshift

From Dev

Openshift port for node.js

From Dev

app.get is undefined (node.js)

From Dev

Deploying basic node.js app to openshift gives errors on git push

From Dev

Deployed Node app to OpenShift successfully, OpenShift still shows default page

From Java

How to get data out of a Node.js http get request

From Dev

how to get the value from request.get in node js

From Dev

Get Request Header in Node.js to get PHP Session ID

From Dev

Get data from GET request in node.js parameters undefined

From Dev

How to deploy node app on openshift and run it?

From Dev

In react js how to send axios GET method request with parameters to Node js and in Node js how to get these parameters

From Dev

Node.JS POST request to Express app secured by passport

From Dev

Say 'Hello World!' in Openshift with Node.js

Related Related

  1. 1

    Node.js app on openshift

  2. 2

    Empty request body with POST using CORS with a node app on OpenShift

  3. 3

    Error while connecting to mysql database in openshift via node js app

  4. 4

    Error while connecting to mysql database in openshift via node js app

  5. 5

    Openshift Node.js app serves javascript but not css

  6. 6

    Determine if Request is Local in Node.js app

  7. 7

    Openshift node app failed to start

  8. 8

    Node js request get page error 500

  9. 9

    Node.js: get path from the request

  10. 10

    Simple get request with node.js and express

  11. 11

    Node.js https get request ECONNRESET

  12. 12

    use GET method in node js request?

  13. 13

    Chaining GET request with a response Node.js

  14. 14

    HTTP GET request with parameters Node.js

  15. 15

    get request object array in node.js

  16. 16

    Perform Get request with body - Node js

  17. 17

    Node.js Deployment in openshift

  18. 18

    Openshift port for node.js

  19. 19

    app.get is undefined (node.js)

  20. 20

    Deploying basic node.js app to openshift gives errors on git push

  21. 21

    Deployed Node app to OpenShift successfully, OpenShift still shows default page

  22. 22

    How to get data out of a Node.js http get request

  23. 23

    how to get the value from request.get in node js

  24. 24

    Get Request Header in Node.js to get PHP Session ID

  25. 25

    Get data from GET request in node.js parameters undefined

  26. 26

    How to deploy node app on openshift and run it?

  27. 27

    In react js how to send axios GET method request with parameters to Node js and in Node js how to get these parameters

  28. 28

    Node.JS POST request to Express app secured by passport

  29. 29

    Say 'Hello World!' in Openshift with Node.js

HotTag

Archive