UND_ERR_HEADERS_TIMEOUT error when trying to partition a large PDF
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- api
Research direction
Start with utils/file-to-md.ts and the POST handler at app/api/files/route.ts, then reproduce the failure with the reported 6.3 MB PDF. Trace the partition request and compare it with a smaller PDF that succeeds. Done means large PDFs no longer fail with UND_ERR_HEADERS_TIMEOUT, with the behavior verified against both sizes.
Written by the indexing model from the issue text.
Description
When trying to partition a 6.3mb PDF using the Javascript API, a "UND_ERR_HEADERS_TIMEOUT" error is thrown:
api Error [ConnectionError]: Unable to make request: TypeError: fetch failed
api at async convertFileToMarkdown (utils/file-to-md.ts:13:35)
api at async POST$1 (webpack-internal:/(rsc)/app/api/files/app/api/files/route.ts:38:36)
api 11 | export async function convertFileToMarkdown(file: File) {
api 12 | try {
api > 13 | const res: PartitionResponse = await unstructuredClient.general.partition({
api | ^
api 14 | partitionParameters: {
api 15 | files: {
api 16 | content: file, {
api [cause]: TypeError: fetch failed
api at async convertFileToMarkdown (utils/file-to-md.ts:13:35)
api at async POST$1 (webpack-internal:/(rsc)/app/api/files/app/api/files/route.ts:38:36)
api 11 | export async function convertFileToMarkdown(file: File) {
api 12 | try {
api > 13 | const res: PartitionResponse = await unstructuredClient.general.partition({
api | ^
api 14 | partitionParameters: {
api 15 | files: {
api 16 | content: file, {
api [cause]: [Error [HeadersTimeoutError]: Headers Timeout Error] {
api code: 'UND_ERR_HEADERS_TIMEOUT'
api }
api }
api }
api {
api markdown: undefined,
api error: 'Unable to make request: TypeError: fetch failed'
api }
Smaller PDFs work fine. Large PDFs fail. Letting the API run indefinitely, the timeout can take approximately a half hour or so until the error is finally throw, which leads me to believe the file is hung up in partitioning inside of Unstructured.io's API.
- Dominant language
- TypeScript
- Stars
- 63
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Unstructured-IO/unstructured-js-client
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Unstructured-IO/unstructured-js-client#146 · 9 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Unstructured-IO/unstructured-js-client#127 · 3 comments ·
-
Disable logging?Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Unstructured-IO/unstructured-js-client#106 · 6 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
Unstructured-IO/unstructured-js-client#100 · 2 comments ·
All issues in Unstructured-IO/unstructured-js-client
Similar issues
-
area: integrations documentation priority: P2 size: XS
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
eddiejaoude/StackDash#798 ·
Maintainers usually reply within 1 day
-
bot:ai-assisted component:midnight-js status:untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
midnightntwrk/midnight-js#1790 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
area:vscode bug has repro platform:macos platform:vscode regression
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
anthropics/claude-code#113502 ·
-
Add: Rajdhani TV HDOpencheck:passed streams:add
Difficulty 1/5 Under an hour Newbie friendliness 77/100
Maintainers usually reply within 1 day