pdf-parse-v2-bun-fix

Fix pdf-parse v2 TypeError in Bun runtime environments.

2|Updated May 10, 2026
One-click install
npx skills add https://github.com/freedomw1987/tree_monstor --skill pdf-parse-v2-bun-fix
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pdf-parse-v2-bun-fix
Source: https://github.com/freedomw1987/tree_monstor/tree/main/skills/debugging/pdf-parse-v2-bun-fix
Command: npx skills add https://github.com/freedomw1987/tree_monstor --skill pdf-parse-v2-bun-fix

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill resolves the TypeError: require("pdf-parse") is not a function error that breaks PDF attachment upload functionality in Bun and Elysia backend projects after upgrading the pdf-parse dependency to version 2.x, which introduced breaking class-based API changes from the previous v1 callable function syntax.

Core Features & Use Cases

  • Precise Error Diagnosis: Includes clear recognition patterns to confirm the error is caused by pdf-parse v2's breaking API changes, eliminating guesswork.
  • Drop-In Code Fix: Provides tested, production-ready replacement code for the broken parsePdf function that is compatible with Bun runtimes.
  • Use Case: Perfect for backend developers maintaining Bun/Elysia services (such as WhatsApp chatbots) with PDF upload features that stopped working after a pdf-parse dependency upgrade.

Quick Start

Use this skill to update the broken parsePdf function in your Bun backend's chat route with the correct pdf-parse v2 class-based API implementation to resolve the 'not a function' error and restore PDF upload functionality.

Frequently Asked Questions about pdf-parse-v2-bun-fix

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does require("pdf-parse") throw a 'not a function' error in Bun?

The require("pdf-parse") is not a function error occurs because pdf-parse v2 introduced breaking class-based API changes, replacing the deprecated v1 callable function syntax used in Bun runtime environments.

How do I fix pdf-parse v2 errors in a Bun and Elysia backend?

To fix pdf-parse v2 errors in Bun and Elysia backends, replace the broken v1 callable function syntax with the v2 class-based PDFParse API implementation to correctly restore PDF text extraction.

Does pdf-parse v2 work with Bun runtime environments for PDF uploads?

Yes, pdf-parse v2 works with Bun runtime environments, but it requires updating your PDF attachment upload functionality to use the new class-based PDFParse API instead of the old callable function syntax.

What is the correct pdf-parse v2 API syntax for extracting PDF text?

The correct pdf-parse v2 API syntax for extracting PDF text involves instantiating the v2 class-based PDFParse API rather than calling the deprecated v1 function directly, ensuring proper text extraction in Bun apps.

Can I still use the old pdf-parse v1 callable function syntax after upgrading?

No, the old pdf-parse v1 callable function syntax is deprecated and will trigger TypeError in Bun and Elysia applications; you must transition to the v2 class-based PDFParse API for PDF text extraction.

How do I restore PDF attachment upload functionality after a pdf-parse dependency upgrade?

To restore PDF attachment upload functionality after upgrading pdf-parse, update your backend's parsePdf function with the production-ready v2 class-based PDFParse API replacement code designed for Bun runtime compatibility.