Backand Error: "Can only invoke functions" when trying to add User?

Backand Error: "Can only invoke functions" when trying to add User?

我正在尝试添加用户,但我一直收到此错误:

"An unexpected signup exception occured The following action: "创建我的应用程序用户”执行失败:只能调用函数只能调用函数只能调用函数

不确定是什么问题...

创建我的应用用户操作

/* globals
$http - Service for AJAX calls 
CONSTS - CONSTS.apiUrl for Backands API URL
Config - Global Configuration
*/
'use strict';
function backandCallback(userInput, dbRow, parameters, userProfile) {

   // When a new user registers, add her to the users object. 
   // If you are using a different object for your users then change this action accordingly. 
   if (parameters.sync)
      return {};
   if (!parameters)
      parameters = {};
   parameters.email = userInput.Username;
   parameters.firstName = userInput.FirstName;
   parameters.lastName = userInput.LastName;
   try{
   var response = $http({
      method: "POST",
      url:CONSTS.apiUrl + "/1/objects/users",
      params: {parameters: {"sync": true}},
      data: parameters,
      headers: {"Authorization": userProfile.token}
   });
}
catch(err) {
   // register user even if there is an error or no users object 
}
   return {};
}

自定义 javascript 引擎上的后端和云代码 运行,因此它有一些限制。

确保函数后面没有任何代码, 甚至在评论中。

你的动作只能是函数,上面或下面没有任何代码或注释。

如果您想在代码中添加其他函数,可以将其添加为内部函数,如下所示:

function backandCallback(userInput, dbRow, parameters, userProfile) {
   function foo(){
      // do something great
   }

   foo();

   return {};
}