TypeError Configuration does not include boxAppSettings object
回答済みHi.
I am trying to make box application by node.js.
But I can't do anything.
First, I tried to run this code.
const fs = require("fs"); const path = require("path"); const box = require("box-node-sdk"); //read json let configFile = fs.readFileSync("config.json"); console.log(JSON.parse(configFile)); // connect to BOX let session = box.getPreconfiguredInstance(configFile); let client = session.getAppAuthClient("enterprise"); client.files.get('0')
Then, respond following message.
C:\Mydir\node_modules\box-node-sdk\lib\box-node-sdk.js:137
throw new TypeError('Configuration does not include boxAppSettings object.'); ^ TypeError: Configuration does not include boxAppSettings object. at Function.BoxSDKNode.getPreconfiguredInstance (C:\Mydir\node_modules\box-node-sdk\lib\box-node-sdk.js:137:9) at Object. (C:\Mydir\test.js:17:19) at Module._compile (internal/modules/cjs/loader.js:688:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10) at Module.load (internal/modules/cjs/loader.js:598:32) at tryModuleLoad (internal/modules/cjs/loader.js:537:12) at Function.Module._load (internal/modules/cjs/loader.js:529:3) at Function.Module.runMain (internal/modules/cjs/loader.js:741:12) at startup (internal/bootstrap/node.js:285:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
This error rises any API calls, likes these.
client.enterprise.getUsers(); client.folders.getItems('0');
Please teach me how can I solve this problem.
Thank you.
-
This error is telling you that the "boxAppSettings" key is missing from your configuration file. Compare it to this example for typo's or missing things:
{ "boxAppSettings": { "clientID": "abc...123", "clientSecret": "def...234", "appAuth": { "publicKeyID": "abcd1234", "privateKey": "-----BEGIN ENCRYPTED PRIVATE KEY-----\n....\n-----END ENCRYPTED PRIVATE KEY-----\n", "passphrase": "ghi...345" } }, "enterpriseID": "1234567" }
サインインしてコメントを残してください。
コメント
2件のコメント