fix(export): align local API routes and config cleanup#4355
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| export/src/app.ts | Route paths updated from /image and /pdf to /api/export/image and /api/export/pdf to align with the deployed server and client. No logic changes. |
| export/src/chrome-executable.ts | Removed config.chromeExecutable early-return path and updated the final error message. Leaves behind an unused import config from './config' that should be cleaned up. |
| export/src/config.ts | Removed chromeExecutable config entry (CHROME_EXECUTABLE env var) as part of the stale config cleanup. No issues. |
| export/.env.example | Removed stale CHROME_EXECUTABLE and MODULE_DATA env var examples; updated comment to reference config.ts; cleared the placeholder Sentry DSN. Clean and accurate. |
| export/public/test.html | New static test page providing quick links to exercise local image and PDF export endpoints. Straightforward and useful for manual testing. |
| website/src/apis/export.ts | Comment updated to reference the new local URL pattern (http://localhost:3000/api/export). No logic changes; baseUrl already pointed at the correct production path. |
Sequence Diagram
sequenceDiagram
participant C as Client (website)
participant E as Export Server (Koa)
participant P as Puppeteer/Chrome
Note over C,E: Before this PR — routes were /image and /pdf
Note over C,E: After this PR — routes are /api/export/image and /api/export/pdf
C->>E: GET /api/export/image?data=...&pixelRatio=...
E->>E: data.parseExportData (middleware)
E->>P: render.openPage — launch/reuse browser, open timetable page
P-->>E: page ready
E->>P: render.image(page, data, options)
P-->>E: PNG buffer
E-->>C: 200 OK — My Timetable.png
C->>E: GET /api/export/pdf?data=...
E->>E: data.parseExportData (middleware)
E->>P: render.openPage — reuse browser page
P-->>E: page ready
E->>P: render.pdf(page, data)
P-->>E: PDF buffer
E-->>C: 200 OK — My Timetable.pdf
Comments Outside Diff (1)
-
export/src/chrome-executable.ts, line 3 (link)Unused import left behind
After removing the
config.chromeExecutablecheck,configis no longer referenced anywhere in this file. The import should be removed to avoid dead code.
Last reviewed commit: ea74a6e
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4355 +/- ##
==========================================
+ Coverage 54.52% 56.67% +2.15%
==========================================
Files 274 308 +34
Lines 6076 6964 +888
Branches 1455 1682 +227
==========================================
+ Hits 3313 3947 +634
- Misses 2763 3017 +254 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| @@ -0,0 +1,16 @@ | |||
| <!doctype html> | |||
There was a problem hiding this comment.
This file will make it easier to test the deployment, just go to /test.html.
I'll look into adding some unit/E2E tests, but Vercel has a different deployment flow so this is still needed for testing on Vercel.
|
|
||
| router | ||
| .get('/image', async (ctx) => { | ||
| .get('/api/export/image', async (ctx) => { |
There was a problem hiding this comment.
Align the routes on Koa vs Vercel.
b03237d to
e3ffd0f
Compare
Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Summary
/api/export/*paths used by the website client and docsexport/public/test.htmlpage for manually exercising local image and PDF exportsCHROME_EXECUTABLEconfig entry, simplifying.env.example, and updating the local export commentsexport/ecosystem.config.js, dropping thedeployscript, and makingpnpm startrun the built server directlyTest plan
pnpm --dir export typecheckpnpm --dir export build