nusmodifications / nusmods

🏫 Official course planning platform for National University of Singapore.
https://nusmods.com
MIT License
558 stars 270 forks source link

fix(export): restore timetable exports through better versioning #3736

Closed kokrui closed 1 week ago

kokrui commented 1 week ago

Context

Closes #3725 and restores the export service!

Previously, the feature to export PDFs and images of timetables was broken. It turns out that the export service wasn't starting the browser properly, and we were:

I'm not exactly sure which issue was breaking the service, but solving both problems restore it and are good things to do anyways. We can root cause this later for posterity (in case this happens again), but I'd like to get the feature up and running again

Implementation

We pin new versions of puppeteer-core and @sparticuz/chromium that are compatible with each other, and use non-deprecated types in the vercel/node library.

Demo

working pdf generation on the preview instance

working image generation on the preview instance

Note: Using the website preview instance to download PDF/Image won't work because that'll try to use export.nusmods.com... maybe we should improve that eventually

vercel[bot] commented 1 week ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nusmods-export ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 21, 2024 7:29am
nusmods-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 21, 2024 7:29am
codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 53.54%. Comparing base (38b85ce) to head (90286f7).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #3736 +/- ## ========================================== + Coverage 53.53% 53.54% +0.01% ========================================== Files 274 274 Lines 6017 6017 Branches 1443 1443 ========================================== + Hits 3221 3222 +1 + Misses 2796 2795 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

jayasting98 commented 1 week ago

Thanks @kokrui for the PR and @ravern for the review. I appreciate the fix.