NIFCLOUD-mbaas / UserCommunity

ニフクラ mobile backend ユーザーコミュニティ
https://mbaas.nifcloud.com/
81 stars 18 forks source link

【過去質問】スクリプト実行で500エラーが発生する #1007

Open ncmbsupport opened 5 years ago

ncmbsupport commented 5 years ago

データストアのあるクラス内のデータを更新する jsスクリプト を下記コードで作成しました。

※プライバシー情報保護のため、コード自体はご提供いただいたものを変更しております※

// ncmbモジュールの読み込み
var NCMB = require("ncmb");

// mobile backendアプリとの連携
var ncmb = new NCMB("APPLICATION_KEY","CLIENT_KEY");

var GameScore = ncmb.DataStore("GameScore");
var gameScore = new GameScore;

gameScore.set('name', 'yamada')
        .save()
        .then(function(gameScore){
           gameScore.set('name', 'tanaka');
           return gameScore.update(); // 保存したgameScoreオブジェクトを更新
         })
 .then(function(gameScore) {
// 更新完了
})
 .catch(function(err) {
// エラー
});

このスクリプトを実行したところ、下記エラーが発生しました。 500番エラーなのですが、システム側で障害等起きていましたでしょうか。

※一部情報を変更しています※

{
 "Status": "ERROR",
 "RequestHeaders": "{\"host\":\"script-console.mbaas.api.nifcloud.com\",\"connection\":\"close\",\"accept\":\"application/json, text/plain, */*\",\"origin\":\"https://console.mbaas.nifcloud.com\",\"user-agent\":\"*******\",\"referer\":\"https://console.mbaas.nifcloud.com/\",\"accept-encoding\":\"gzip, deflate, br\",\"accept-language\":\"ja,en-US;q=0.9,en;q=0.8\"}",
 "RequestQuery": "{}",
 "ResponseHeaders": "{}",
 "Error": "ScriptError: TypeError: handler is not a function\n at Module._compile (module.js:652:30)\n at Object.Module._extensions..js (module.js:663:10)\n at Module.load (module.js:565:32)\n at tryModuleLoad (module.js:505:12)\n at Function.Module._load (module.js:497:3)\n at Function.Module.runMain (module.js:693:10)\n at startup (bootstrap_node.js:191:16)\n at bootstrap_node.js:612:3",
 "Duration": 2202,
 "created_at": "2019-xx-xxTxx:xx:xx.xxxZ",
 "updated_at": "2019-xx-xxTxx:xx:xx.xxxZ",
 "ResponseStatus": 500,
 "ScriptIdentifier": "xxxx.js" 
}
ncmbsupport commented 5 years ago

初めに、該当時間にmobile backendシステム側での障害は特に発生しておりませんでした。

今回ご連絡いただきましたエラー内容については、 スクリプトコードを見直していただくことで解消されるのではないかと考えております。

下記ドキュメントをご参考ください。