fix(file-upload): fix nextjs file upload issue with pdf-parse#1321
fix(file-upload): fix nextjs file upload issue with pdf-parse#1321waleedlatif1 merged 3 commits intostagingfrom
Conversation
There was a problem hiding this comment.
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
* 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.
* 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.
…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.
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
Testing
Tested manually.
Checklist