2017-02-13 58 views
3

我開始使用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)) 

預先感謝您在百忙之中的英語不好

回答

0

我更換

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功能