Search code examples
node.jsparse-platformdigital-oceanbitnamiparse-server

S3 Adapter Module Causing Parse Server Start Fail


I am running a Parse Standalone server through Bitnami hosted on a digitalocean droplet. I am trying to initialize the amazon s3 bucket module for file uploads and it's causing my parse server to crash when starting.

in my /opt/bitnami/apps/parse/htdocs/server.js I am adding

var S3Adapter = require('parse-server').S3Adapter;

Which seems to be causing my parse server to fail during startup.

Full Config:

var express = require('express');
var ParseServer = require('./lib').ParseServer;
var S3Adapter = require('parse-server').S3Adapter;
var app = express();


// Specify the connection string for your mongodb database
// and the location to your Parse cloud code
var api = new ParseServer({
    databaseURI: 'mongodb://USER:PASS@127.0.0.1:27017/DATABASENAME',
    cloud: './cloud/main.js',
    appId: 'KEY',
    masterKey: 'KEY',
    fileKey: 'KEY',
    serverURL: 'http://pdb1.SERVERURL.com:1337/parse',
    filesAdapter: new S3Adapter(
      "KEY",
      "KEY",
      "BUCKET",
      {directAccess: true}
    ),
});

Commenting out the require and filesAdapter lines allows the server to start properly.

Any Suggestions?


Solution

  • Since you have var ParseServer = require('./lib').ParseServer; I would assume that you are not using NPM or the Parse-Server-Example.

    In your case, I believe this line:

    var S3Adapter = require('parse-server').S3Adapter;
    

    Should be:

    var S3Adapter = require('./lib').S3Adapter;
    

    After looking at the index.js for the Parse-Server on GitHub it appears that the S3Adapter is also exposed by default.