Search code examples
amazon-web-servicesparse-server

AWS Hosted Parse-server can't find cloud code


We are in the process of migrating from parse.com to AWS. The solution works perfectly fine locally, however once i eb deploy to AWS, it cannot load the cloud code file.

Error: Cannot find module '/cloud/main.js'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at new ParseServer (/var/app/current/node_modules/parse-server/lib/ParseServer.js:268:9)
    at new _ParseServer (/var/app/current/node_modules/parse-server/lib/index.js:38:16)
    at Object.<anonymous> (/var/app/current/index.js:8:11)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)

My parse server config looks like this:

var api = new ParseServer({
    databaseURI: config.DATABASE_URI ,
    cloud:  __dirname + '/cloud/main.js' ,
    appId: config.parse.APP_ID,
    masterKey: config.parse.MASTER_KEY ,
    restApiKey: config.parse.REST_API_KEY,
    serverURL: config.parse.SERVER_URL   // Don't forget to change to https if needed
});

AWS obviously cant find the file @ __dirname + '/cloud/main.js' What should i set this to for AWS?


Solution

  • So I just removed the leading / and now it works.

    It now reads cloud: 'cloud/main.js' ,