From 8445d7684e957cfb1b56705d041e0092dcbb936d Mon Sep 17 00:00:00 2001 From: Tommy Goode Date: Mon, 4 Apr 2016 01:42:22 -0500 Subject: [PATCH] Fixes #1334 by resolving relative cloud code file paths to the process' working directory. --- spec/helper.js | 2 +- src/ParseServer.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/helper.js b/spec/helper.js index e8cabbb4ea..c134f339ab 100644 --- a/spec/helper.js +++ b/spec/helper.js @@ -10,7 +10,7 @@ var ParseServer = require('../src/index').ParseServer; var path = require('path'); var databaseURI = process.env.DATABASE_URI; -var cloudMain = process.env.CLOUD_CODE_MAIN || '../spec/cloud/main.js'; +var cloudMain = process.env.CLOUD_CODE_MAIN || './spec/cloud/main.js'; var port = 8378; // Default server configuration for tests. diff --git a/src/ParseServer.js b/src/ParseServer.js index 85f8a98b7f..f654b2855a 100644 --- a/src/ParseServer.js +++ b/src/ParseServer.js @@ -9,6 +9,7 @@ var batch = require('./batch'), middlewares = require('./middlewares'), multer = require('multer'), Parse = require('parse/node').Parse, + path = require('path'), authDataManager = require('./authDataManager'); import { logger, @@ -140,7 +141,7 @@ class ParseServer { if (typeof cloud === 'function') { cloud(Parse) } else if (typeof cloud === 'string') { - require(cloud); + require(path.resolve(process.cwd(), cloud)); } else { throw "argument 'cloud' must either be a string or a function"; }