-
Notifications
You must be signed in to change notification settings - Fork 40
Open
1 / 11 of 1 issue completedDescription
使用其提供的示例代码,
// node-sdk使用说明:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/nodejs-sdk/preparation-before-development
// 以下示例代码默认根据文档示例值填充,如果存在代码问题,请在 API 调试台填上相关必要参数后再复制代码使用
const lark = require('@larksuiteoapi/node-sdk');
const fs = require('fs');
// 开发者复制该Demo后,需要修改Demo里面的"app id", "app secret"为自己应用的appId, appSecret
const client = new lark.Client({
appId: 'app id',
appSecret: 'app secret',
// disableTokenCache为true时,SDK不会主动拉取并缓存token,这时需要在发起请求时,调用lark.withTenantToken("token")手动传递
// disableTokenCache为false时,SDK会自动管理租户token的获取与刷新,无需使用lark.withTenantToken("token")手动传递token
disableTokenCache: true
});
const file = fs.readFileSync('output.png');
client.im.v1.image.create({
data: {
image_type: 'avatar',
image: file,
},
},
lark.withTenantToken("t-g1041l9DGV7LG4FRQU7HEVYPLGZXJ4VGEK6CE7IU")
).then(res => {
console.log(res);
}).catch(e => {
console.error(JSON.stringify(e.response.data, null, 4));
});
使用node sdk上传,
TypeError: source.on is not a function
at DelayedStream.create (/www/my-app/node_modules/delayed-stream/lib/delayed_stream.js:33:10)
at CombinedStream.append (/www/my-app/node_modules/combined-stream/lib/combined_stream.js:46:37)
at FormData.append (/www/my-app/node_modules/form-data/lib/form_data.js:75:3)
at build (/www/my-app/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/toFormData.js:63:16)
at each (/www/my-app/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/toFormData.js:58:9)
at Object.forEach (/www/my-app/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/utils.js:276:12)
at build (/www/my-app/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/toFormData.js:40:13)
at toFormData (/www/my-app/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/toFormData.js:67:3)
at Object.transformRequest (/www/my-app/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/defaults/index.js:80:14)
at transform (/www/my-app/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/transformData.js:18:15)
Sub-issues
Metadata
Metadata
Assignees
Labels
No labels