Skip to content

UND_ERR_HEADERS_TIMEOUT error when trying to partition a large PDF #162

@hichana

Description

@hichana

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions