Usergrid node.js usergrid.init()错误
问题描述:
我开始使用apigee,并使用包含usergrid和node.js sdk的当我在本地使用我的文件并使http请求没有问题,但当我尝试上传与node.js的文件:Usergrid node.js usergrid.init()错误
apigeetool deployproxy -u USERNAME -p PASSWORD -o ORG -e test -n hello -d .
,并设法使我的请求得到了错误
{"fault":{"faultstring":"Script node executed prematurely: TypeError: Cannot find function setPrototypeOf in object function Object() { [native code for Object.Object, arity=1] }\n.\nTypeError: Cannot find function setPrototypeOf in object function Object() { [native code for Object.Object, arity=1] }\n.\n at \/organization\/environment\/api\/node_modules\/usergrid\/usergrid.js:29\n at \/organization\/environment\/api\/app.js:28\n at module.js:456\n at module.js:474\n at module.js:356\n at module.js:312\n at module.js:497\n at startup (trireme.js:142)\n at trireme.js:923\n","detail":{"errorcode":"scripts.node.runtime.ScriptExitedError"}}}
它似乎来自我的app.js文件,该行:
usergrid.init();
,并更准确地从我的usergrid.js文件,该行
Object.setPrototypeOf(self, new UsergridClient(options))
预先感谢您在百忙之中的英语不好
答
我更换
usergrid.init();
通过
var UsergridClient = require('./node_modules/usergrid/lib/client')
var Usergrid = new UsergridClient
({
"appId": "<my_appId>",
"orgId": "<my_orgId>",
"authMode": "<my_authMode>",
"baseUrl": "<my_baseUrl>",
"clientId": "<my_clientId>",
"clientSecret": "<my_clientSecret>"
})
这样,usergrid.js不会被执行,也不会调用setPrototy peOf功能