Parse-server: Invalid function when calling could code but hello function is working

Created on 24 Mar 2016  路  8Comments  路  Source: parse-community/parse-server

Hello. I am having this issue for over 4 days now and i have no idea how to fix it :( This is my setup
in server.js :
var parseServer = new ParseServer({
databaseURI: "XXXXXXX",
cloud: './cloud/main.js',
appId: "XXXXXX",
masterKey: "XXXXXXX",
serverURL: "https://parsetestapi.appspot.com/parse/"
});

and in app.yaml
CLOUD_PATH: './cloud/main.js'

Please help me i am desperate :D

Most helpful comment

You shoud use absolute path for your cloud code.

cloud: __dirname + './cloud/main.js' instead of cloud: './cloud/main.js',

All 8 comments

You shoud use absolute path for your cloud code.

cloud: __dirname + './cloud/main.js' instead of cloud: './cloud/main.js',

cloud: __dirname + "/cloud/main.js" so this is now my could path in the server.js file and this is the cloud path that i have in my app.yaml CLOUD_PATH: ./cloud/main.js . But it does not want to deploy my code...

also tried CLOUD_PATH: "./cloud/main.js" and cloud: __dirname + "/cloud/main.js" nothing

Please someone paste the code from app.yaml and server.js that IS working... I feel desperate :S

not sure why you're using app.yaml
the cloud code main.js has to be inside the same directory that's containing your parse-server.js.

parse-server
..cloud
....main.js
parse-server.js

and then parse-server.js should look like this:

var api = new ParseServer({ databaseURI: 'mongodb://localhost:27017/DATABASE', appId: 'APP_ID', masterKey: 'MASTER_KEY', cloud: __dirname + '/cloud/main.js', serverURL: 'http://localhost:1337/parse', // Don't forget to change to https if needed push: { android: { senderId: 'SENDER_ID', apiKey: 'GOOGLE_API_KEY' } } });

Ok very weird. Now i get " Error Response: [13] Timed out when starting VM's " when i use npm run deploy but now i don't get Invalid function i get bad json. I looked into it and i do have serverURL: "https://parsetestapi.appspot.com/parse/" as i am supposed to...

The problem was that i did not have fileKey... i do not use files but i still need this. Thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings