TypeError when Downloading to PDF in Azure App Service: undici failure
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- azure, node.js, typescript
调研方向
Start with conversionDownloadToPdf and the @microsoft/microsoft-graph-client request using ResponseType.RAW, then compare the local and Azure App Service environments on Node v18.19.1. Inspect the full undici error cause and determine whether ProxyAgent or an officially documented workaround addresses the failure; done means the PDF download works in Azure or the limitation is clearly documented.
由索引模型根据 Issue 内容生成。
描述
Download to PDF Not Working in Azure App Service
I'm running an express app using Node v18.19.1. My endpoint does the following:
- Saves a document to a sharepoint folder
- Performs the download/convert to pdf
- Saves the downloaded pdf to a Mongo db.
- Deletes the original file
Steps 1, 2, and 4 use the @microsoft/microsoft-graph-client@3.0.7 package. This all works locally. However, when I deploy it to my Azure App Services (running Windows and Node v18.19.1), it breaks at step 2 with the following error:
TypeError: fetch failed at node:internal/deps/undici/undici:12625:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
The conversion download method:
const conversionDownloadToPdf = async (fileItemId) => {
try {
console.log(chalk.blue(`Attempting to downloaded file (${fileItemId})...`));
const response = await client.api(`drives/${process.env.DRIVE_ID}/items/${fileItemId}/content?format=pdf`)
.responseType(ResponseType.RAW) // ensure raw stream
.get();
const stream = await apiRequest.responseType(ResponseType.RAW).get(); // BREAKS HERE
console.log(chalk.blue(`Stream downloaded. Streaming to buffer...`));
return await toBuffer(stream);
} catch (error) {
console.error(chalk.red(`Full error details:`));
console.error(chalk.red(`Message: ${error.message}`));
console.error(chalk.red(`Status Code: ${error.statusCode}`));
console.error(chalk.red(`Code: ${error.code}`));
console.error(chalk.red(`Stack: ${error.stack}`));
// Log the cause if available (undici errors have this)
if (error.cause)
console.error(chalk.red(`Cause: ${JSON.stringify(error.cause, null, 2)}`));
throw error;
}
}
Do I need to use that ProxyAgent? Do you have official docs on a workaround?
- 主要语言
- TypeScript
- 星标
- 833
- 派生
- 240
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoftgraph/msgraph-sdk-javascript 的其他 Issue
-
status:waiting-for-triage
难度 1/5 1 小时以内 新手友好度 62/100
-
Is anyone here? 未关闭
难度 4/5 3-5 天 新手友好度 25/100
microsoftgraph/msgraph-sdk-javascript#2005 · 1 个 reaction ·
-
status:waiting-for-triage
难度 5/5 一周以上 新手友好度 42/100
-
status:waiting-for-triage type:bug
难度 3/5 1-2 天 新手友好度 48/100
microsoftgraph/msgraph-sdk-javascript#1999 · 2 条评论 · 1 个 reaction ·
-
status:waiting-for-triage type:bug
难度 4/5 3-5 天 新手友好度 45/100
查看 microsoftgraph/msgraph-sdk-javascript 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 1/5 1 小时以内 新手友好度 85/100
-
check:passed streams:add
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 2/5 1-3 小时 新手友好度 68/100