TypeError: source.on is not a function at DelayedStream.create (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/delayed-stream/lib/delayed_stream.js:33:10) at CombinedStream.append (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/combined-stream/lib/combined_stream.js:45:37) at FormData.append (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/form-data/lib/form_data.js:75:3) at build (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/toFormData.js:63:16) at each (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/toFormData.js:58:9) at Object.forEach (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/utils.js:276:12) at build (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/toFormData.js:40:13) at toFormData (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/toFormData.js:67:3) at Object.transformRequest (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/defaults/index.js:80:14) at transform (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/transformData.js:18:15) at Object.forEach (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/utils.js:270:10) at Object.transformData (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/transformData.js:17:9) at dispatchRequest (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/dispatchRequest.js:35:31) at Axios.request (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/Axios.js:109:15) at Function.wrap [as request] (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/bind.js:9:15) at Client.<anonymous> (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/lib/index.js:48123:26)
TypeError: source.on is not a function at DelayedStream.create (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/delayed-stream/lib/delayed_stream.js:33:10) at CombinedStream.append (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/combined-stream/lib/combined_stream.js:45:37) at FormData.append (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/form-data/lib/form_data.js:75:3) at build (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/toFormData.js:63:16) at each (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/toFormData.js:58:9) at Object.forEach (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/utils.js:276:12) at build (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/toFormData.js:40:13) at toFormData (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/toFormData.js:67:3) at Object.transformRequest (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/defaults/index.js:80:14) at transform (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/transformData.js:18:15) at Object.forEach (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/utils.js:270:10) at Object.transformData (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/transformData.js:17:9) at dispatchRequest (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/dispatchRequest.js:35:31) at Axios.request (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/core/Axios.js:109:15) at Function.wrap [as request] (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/node_modules/axios/lib/helpers/bind.js:9:15) at Client.<anonymous> (/Users/michael/Projects/funitech/chatbot-ai-be/node_modules/@larksuiteoapi/node-sdk/lib/index.js:48123:26)
When running this functions
const client = new lark.Client({ appId: token.thirdPartyId, appSecret: token.accessToken, appType: lark.AppType.SelfBuild, domain: lark.Domain.Lark, }); try { request(link) .pipe(fs.createWriteStream(
./temp/${key}.png)) .on("close", async () => { let res = await client.im.image.create({ data: { image_type, image: await fs.readFileSync(
./temp/${key}.png), }, }); fs.unlinkSync(
./temp/${key}.png`);