2016-04-28 7 views
0

Ich habe einen Parse-Server auf Heroku (mLab.com als Datenbank) bereitgestellt, habe aber einige Probleme mit Cloud-Code.Parse-Server-Probleme mit Cloud-Code.

Wenn die "Hallo" -Funktion aufgerufen wird, funktioniert alles Flossen.

Wenn die „Testfunktion“ nennen, was wiederum eine Abfrage Anfrage macht, bekomme ich diesen Fehler:

XMLHttpRequest cannot load https://xxxxx.herokuapp.com/parse/functions/testFunction. 
    No 'Access-Control-Allow-Origin' header is present on the requested resource. 
Origin 'http://127.0.0.1:51488' is therefore not allowed access. 
The response had HTTP status code 503. 

schon ohne Erfolg mit cors spielen. Alle Vorschläge würden sehr geschätzt werden.

------------ CLIENT ------------ 
Parse.initialize("xxxxxx"); 
Parse.serverURL = 'https://xxxxx.herokuapp.com/parse/' 

Parse.Cloud.run('hello').then(function (result) { 
    console.log(result); 
}); 

Parse.Cloud.run('testFunction').then(function (result) { 
    console.log(result); 
}); 

------------ SERVER ----------- 

Parse.Cloud.define('hello', function (req, res) { 
    res.success('Hi'); 
}); 

Parse.Cloud.define("testFunction", function (request, response) { 
    var query = new Parse.Query("Jobs"); 
    query.find().then(function (result) { 
     response.success("Success: " + result); 
    }); 
}); 

Antwort

1

Finden Sie das Problem heraus. Ich hatte vergessen, die SERVER_URL in Umgebungsvariablen in heroku hinzuzufügen.