Skip to content

fix(file-upload): fix nextjs file upload issue with pdf-parse#1321

Merged
waleedlatif1 merged 3 commits intostagingfrom
fix/file-upload
Sep 11, 2025
Merged

fix(file-upload): fix nextjs file upload issue with pdf-parse#1321
waleedlatif1 merged 3 commits intostagingfrom
fix/file-upload

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

fix nextjs file upload issue with pdf-parse, was getting some weird, but documented issue https://stackoverflow.com/questions/76424198/why-do-pdf-parsing-libraries-pdf2json-and-pdf-parse-seem-to-not-work-with-next-j

Type of Change

  • Bug fix

Testing

Tested manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel Bot commented Sep 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs Building Building Preview Comment Sep 11, 2025 9:13pm
sim Building Building Preview Comment Sep 11, 2025 9:13pm

@waleedlatif1 waleedlatif1 merged commit c591433 into staging Sep 11, 2025
3 of 5 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/file-upload branch September 11, 2025 21:13
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR fixes a documented NextJS compatibility issue with the pdf-parse library that was preventing PDF file uploads from working properly. The issue stems from webpack bundling conflicts where pdf-parse contains native dependencies and binary modules that cannot be processed through NextJS's bundling system.

The fix involves adding pdf-parse to the serverExternalPackages configuration in next.config.ts, which tells NextJS to treat the library as an external dependency rather than attempting to bundle it. This is a standard solution for Node.js libraries that contain native code or need direct file system access.

Additionally, the PR includes a minor UI improvement in the file upload component, changing the progress indicator styling from hardcoded color values to use the CSS variable bg-foreground, which provides better theme consistency across the application.

This change is specifically targeted at improving the file upload functionality for PDF documents, which appears to be used in blocks like the Mistral parser that processes PDF files for text extraction. The fix aligns with established patterns for handling problematic libraries in NextJS applications and follows the project's approach to using semantic CSS variables for theming.

Confidence score: 5/5

  • This PR is extremely safe to merge with virtually no risk of causing issues
  • Score reflects a well-documented, targeted fix for a known NextJS compatibility issue with minimal surface area for problems
  • No files require special attention as both changes are straightforward and follow established patterns

2 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

waleedlatif1 added a commit that referenced this pull request Sep 12, 2025
* update infra and remove railway

* fix(file-upload): fix nextjs file upload issue with pdf-parse

* Revert "update infra and remove railway"

This reverts commit b23258a.
Sg312 pushed a commit that referenced this pull request Sep 15, 2025
* update infra and remove railway

* fix(file-upload): fix nextjs file upload issue with pdf-parse

* Revert "update infra and remove railway"

This reverts commit b23258a.
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
…dioai#1321)

* update infra and remove railway

* fix(file-upload): fix nextjs file upload issue with pdf-parse

* Revert "update infra and remove railway"

This reverts commit b23258a.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant