Skip to content

My web application was down when attaching dashboard. #402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
ghost opened this issue Jun 7, 2016 · 10 comments
Closed
2 tasks done

My web application was down when attaching dashboard. #402

ghost opened this issue Jun 7, 2016 · 10 comments

Comments

@ghost
Copy link

ghost commented Jun 7, 2016

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Dashboard!

  • You're running version >=2.1.4 of Parse Server.
  • You've searched through existing issues. Chances are that your issue has been reported or resolved before.

Environment Setup

  • Use Microsoft Azure Web App Service (B1 Plan).
  • based on 'parse-server-example'.

Steps to reproduce

  1. Created parse-dashboard object in index.js
  2. attach 1. to express app.
  3. set port listener

Actual Result

No any response(s).

index.js code.

var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var path = require('path');
var AzureStorageAdapter = require('parse-server-azure-storage').AzureStorageAdapter;
var ParseDashboard = require('parse-dashboard');

var databaseUri = process.env.DATABASE_URI || process.env.MONGODB_URI;

if (!databaseUri) {
    console.log('DATABASE_URI not specified, falling back to localhost.');
}

var azureStorageAdapter;
if (process.env.STORAGE_ACCOUNT && process.env.STORAGE_CONTAINER && process.env.STORAGE_ACCESS_KEY) {
    var options = {
        accessKey: process.env.STORAGE_ACCESS_KEY,
        directAccess: true
    };

    azureStorageAdapter = new AzureStorageAdapter(process.env.STORAGE_ACCOUNT, process.env.STORAGE_CONTAINER, options);
} else {
    azureStorageAdapter = null;
}

var applicationId = process.env.APP_ID;
var appMasterKey = process.env.MASTER_KEY;
var applicationURL = process.env.SERVER_URL;

var parseConfiguration = {
    databaseURI: databaseUri,
    cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
    appId: applicationId,
    masterKey: appMasterKey,
    clientKey: process.env.CLIENT_KEY || 'clientKey',
    serverURL: applicationURL,
    pushConfig: {
        android: {
            senderId: "sender_id",
            apiKey: "api_key"
        }
    }
};

var dashboard = new ParseDashboard({
    "apps": [{
        "serverURL": applicationURL,
        "appId": applicationId,
        "masterKey": appMasterKey,
        "appName": "MyApp"
    }]
});

if (azureStorageAdapter != null) {
    parseConfiguration.filesAdapter = azureStorageAdapter;
}

var api = new ParseServer(parseConfiguration);

var app = express();

// Serve static assets from the /public folder
app.use('/public', express.static(path.join(__dirname, '/public')));

var mountPath = process.env.PARSE_MOUNT || '/parse';
app.use(mountPath, api);
app.use('/dashboard', dashboard);

app.get('/', function(req, res) {
    res.status(200).send('Make sure to star the parse-server repo on GitHub!  ');
});

app.get('/test', function(req, res) {
    res.sendFile(path.join(__dirname, '/public/test.html'));
});

var port = process.env.PORT || 1337;
var httpServer = require('http').createServer(app);
httpServer.listen(port, function() {
    console.log('parse-server-example running on port ' + port + '.');
});
httpServer.listen(4040, function(){
    console.log('parse-dashboard running on port 4040.');
});


Logs/Trace

Note: If you get a browser JS error please run npm run dev. This will provide source maps and a much more useful stack trace.

It was not created log file(s).

@drew-gross
Copy link
Contributor

Your code includes a lot of stuff that isn't relevant to the issue. Could you try boiling this down to a few lines that reproduce the issue?

@ghost
Copy link
Author

ghost commented Jun 8, 2016

var express = require('express');
var path = require('path');
var ParseDashboard = require('parse-dashboard');
var ParseServer = require('parse-server').ParseServer;
var AzureStorageAdapter = require('parse-server-azure-storage').AzureStorageAdapter;

var options = {
    accessKey: process.env.STORAGE_ACCESS_KEY,
    directAccess: true
};

var api = new ParseServer({
    databaseURI: process.env.DATABASE_URI || process.env.MONGODB_URI,
    cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
    appId: process.env.APP_ID,
    masterKey: process.env.MASTER_KEY,
    clientKey: process.env.CLIENT_KEY || 'clientKey',
    serverURL: process.env.SERVER_URL,
    filesAdapter: new AzureStorageAdapter(process.env.STORAGE_ACCOUNT, process.env.STORAGE_CONTAINER, options),
    pushConfig: {
        android: {
            senderId: "SENDER_ID",
            apiKey: "API_KEY"
        }
    },
    liveQuery: {
        classNames: [~OBJECTS~]
    }
});

var dashboard = new ParseDashboard({
    "apps": [{
        "serverURL": process.env.SERVER_URL,
        "appId": process.env.APP_ID,
        "masterKey": process.env.MASTER_KEY,
        "appName": "MyApp"
    }]
});

var app = express();
app.use('/parse', api);
app.use('/dashboard', dashboard);

app.get('/', function(req, res) {
    res.status(200).send('Make sure to star the parse-server repo on GitHub!');
});

var httpServer = require('http').createServer(app);
httpServer.listen(process.env.PORT);
httpServer.listen(4040);

ParseServer.createLiveQueryServer(httpServer);

I changed code simply, but still same thing. And not created log files ether.

@davimacedo
Copy link
Member

Both server and dashboard are not responding? What do you mean by "was down when attaching dashboard"? If you comment the line "app.use('/dashboard', dashboard);" does it work?

@ghost
Copy link
Author

ghost commented Jun 8, 2016

Yes. parse and dashboard are not responding.

Attaching mean already you said, added this code to index.js :

.......
app.use('/dashboard', DASHBOARD_CONFIG_OBJ);
.......
httpServer.listen(4040);
.......

after that, was not working.

Now after disabled that code, working fine.

@davimacedo
Copy link
Member

davimacedo commented Jun 8, 2016

remove just httpServer.listen(4040); and try again please

@ghost
Copy link
Author

ghost commented Jun 8, 2016

Okay. I'll try it.

@ghost
Copy link
Author

ghost commented Jun 8, 2016

Now, parse server is working, but dashboard show this :
2016-06-08 10 19 02

@drew-gross
Copy link
Contributor

Usually this means there is a load balancer doing SSL termination. You can configure the load balancer to only allow HTTPS connections, and then enable the --allowInsecureHTTP option in your dashboard.

@ghost
Copy link
Author

ghost commented Jun 9, 2016

2016-06-09 11 37 50

![2016-06-09 11 39 43](https://cloud.githubusercontent.com/assets/4546119/15917357/e43eb56c-2e36-11e6-8774-fca83eefb510.png)

I added 'allowInsecureHTTP' option to application setting, and shown 503 HTTP error page.

@ghost
Copy link
Author

ghost commented Jun 9, 2016

Okay. I checked this issus, and added option to dashboard configuration :

var dashboardConfig = {
    "allowInsecureHTTP": true,
    "apps": [{
        "serverURL": process.env.SERVER_URL,
        "appId": process.env.APP_ID,
        "masterKey": process.env.MASTER_KEY,
        "appName": "MyApp"
    }]
};

Solved.

#46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants