Search code examples
postgresqlparse-server

Parse Server running with postgres Parse error: error: column "_rperm" does not exist


I have setup the parse server to connect in postgres database. databaseURI: 'postgres://postgres:mypassoword@localhost:5432/fantasy'. After that I have started the server with: nodejs index.js.

The service have started fine, however when I try to make a call to my API, I am getting the follow error in /var/log/postgresql/postgresql-9.6-main.log

postgres@fantasy ERROR: column "_rperm" does not exist at character 30 2019-10-01 21:44:47.468 -03 [10895] postgres@fantasy STATEMENT: SELECT * FROM "jogos" WHERE ("_rperm" IS NULL OR "_rperm" && ARRAY['','']) LIMIT 100

The logs in Parse server (version: ) are:

error: Parse error: error: column "_rperm" does not exist {"code":1,"stack":"Error: error: column \"_rperm\" does not exist\n
at /root/parse-server-example/node_modules/parse-server/lib/Controllers/DatabaseController.js:1179:21\n at processTicksAndRejections (internal/process/task_queues.js:93:5)"}

I am using the current version of parse server version 3.9.0.

Any help will be appreciated.


Solution

  • Following the tips of @DaviMacêdo I was able to solve my problem by creating the objects/tables directly through the Parse Dashboard.

    First I have to create self sign certificates:

    $ openssl req -newkey rsa:2048 -new -nodes -keyout key.pem -out csr.pem
    $ openssl x509 -req -days 365 -in csr.pem -signkey key.pem -out server.crt
    

    Then I created a node script to initialize both the parse server and parse dashboard. file: dashboard.js:

    var fs = require('fs');
    var http = require('http');
    var https = require('https');
    var express = require('express');
    var ParseServer = require('parse-server').ParseServer;
    var ParseDashboard = require('parse-dashboard');
    var app = express();
    var port = 1337;
    
    var options = {
        key: fs.readFileSync('./key.pem', 'utf8'),
        cert: fs.readFileSync('./server.crt', 'utf8'),
    };
    
    var parse = new ParseServer({
        databaseURI: 'postgres://postgres:dbpassword@localhost:5432/fantasy',
        appId: 'fantasy',
        masterKey: 'MyPa$$word',
        serverURL: 'http://localhost:1337/parse' 
    });
    
    var dashboard = new ParseDashboard({
        "apps": [{
            "serverURL": "https://myserver:1337/parse",
            "appId": "fantasy",
            "masterKey": "MyPa$$word",
            "appName": "Fantasy"
        }],
        "users": [{
            "user": "admin",
            "pass": "MyPa$$word"
        }]
    });
    
    app.use('/parse', parse);
    app.use('/dashboard', dashboard);
    
    var server = https.createServer(options, app).listen(port, function() {
        console.log("server listening on port " + port);
    });
    

    To start parse server and parse dashboard:

    $ node dashboard.js &