2016-04-28 9 views
0

私はheroku(データベースとしてmLab.com)に解析サーバを導入しましたが、クラウドコードにはいくつか問題があります。クラウドコードのサーバーの解析に問題があります。

"hello"関数を呼び出すと、すべてがフィンで動作します。ターンでクエリ要求を行う「testFunction」を呼び出すとき

、私はこのエラーを取得する:

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. 

は、任意の運なしCORSで遊んでされて。 何か提案がありがとうございます。

------------ 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); 
    }); 
}); 

答えて

1

問題を見つけます。私はherokuの環境変数にSERVER_URLを追加するのを忘れていました。

関連する問題