Heroku App crashes with H10 code possible because of mongo db url

31 Views Asked by At

Is this still possible to use Parse Server on Heroku. I found out that the most of videos and articles were created 2-7 years ago.

I deployed my forked code from https://github.com/parse-community/parse-server-example to the Heroku app,

but when I try to reach my Heroku app url it trows error:

heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=parse-server-example-heroku-5799b138a415.herokuapp.com request_id=6887bbaa-b870-4fb1-81a4-d23aebeff877 fwd="79.117.228.140" dyno= connect= service= status=503 bytes= protocol=https

I investigated solution from this link but nothing helps.

Espicaily I did not find Procfile in the repo.

I noticed that old videos say that we need to use mLab MongoDB which is not available anymore, I've tried another one which was suggested ObjectRocket for MongoDB

But it did not resolved the problem probably because of key/value setup:

export const config = {
  databaseURI:
    process.env.DATABASE_URI || process.env.MONGODB_URI || 'mongodb://localhost:27017/dev',

As I understand we probably need to use ObjectRocket and setup it correctly.

this is the full config:

export const config = {
  databaseURI:
    process.env.DATABASE_URI || process.env.MONGODB_URI || 'mongodb://localhost:27017/dev',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || 'myAppId',
  masterKey: process.env.MASTER_KEY || 'myMasterKey', //Add your master key here. Keep it secret!
  serverURL: process.env.SERVER_URL || 'https://parse-server-example-heroku-5799b138a415.herokuapp.com/', // Don't forget to change to https if needed
  liveQuery: {
    classNames: ['Posts', 'Comments'], // List of classes to support for query subscriptions
  },
};
1

There are 1 best solutions below

3
Chris On

You're using the wrong environment variable.

ObjectRocket for MongoDB doesn't set MONGODB_URI, but rather ORMONGO_URL and ORMONGO_RS_URL, with the latter being preferred.

Update your configuration accordingly:

export const config = {
  databaseURI:
    process.env.DATABASE_URI || process.env.ORMONGO_RS_URL || 'mongodb://localhost:27017/dev',

You can probably remove the DATABASE_URI option as well. The ObjectRocket variable will be used on Heroku, and you're presumably using the literal for local development; I'm not sure why the DATABASE_URI would be necessary.

export const config = {
  databaseURI:
    process.env.ORMONGO_RS_URL || 'mongodb://localhost:27017/dev',