Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Thank you for following the naming conventions! 🙏 |
commit: |
There was a problem hiding this comment.
Pull request overview
This pull request adds client-to-server log transport functionality, allowing browser logs to be centrally collected on the server for unified logging across client and server contexts.
Changes:
- Introduces
TransportConfigandIngestPayloadtypes for client log transport configuration - Adds
/api/_evlog/ingestPOST endpoint for receiving client logs with validation via Zod - Extends client logger to send logs to the server via fetch when transport is enabled (default: enabled in production, disabled in development)
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/evlog/src/types.ts | Defines TransportConfig and IngestPayload interfaces for log transport |
| packages/evlog/src/runtime/server/routes/_evlog/ingest.post.ts | Implements server endpoint to receive and process client logs via evlog:drain hook |
| packages/evlog/src/runtime/client/plugin.ts | Configures transport settings in client plugin initialization |
| packages/evlog/src/runtime/client/log.ts | Adds sendToServer function to transmit logs to the ingest endpoint |
| packages/evlog/src/nuxt/module.ts | Registers ingest handler and exposes transport configuration to runtime config |
| packages/evlog/src/index.ts | Exports new IngestPayload and TransportConfig types |
| packages/evlog/build.config.ts | Adds ingest handler to build entries and marks h3/zod as external dependencies |
| apps/playground/nuxt.config.ts | Enables transport in playground for testing |
| apps/docs/content/1.getting-started/2.installation.md | Documents client transport feature with configuration and usage examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 11 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| await fetch(transportEndpoint, { | ||
| method: 'POST', | ||
| headers: { 'Content-Type': 'application/json' }, | ||
| body: JSON.stringify(event), |
There was a problem hiding this comment.
The fetch request doesn't specify credentials mode. For authenticated applications where cookies are needed for authentication or CSRF protection, the fetch should include credentials: 'same-origin' to ensure cookies are sent with the request. Consider adding this option or documenting the authentication requirements.
| body: JSON.stringify(event), | |
| body: JSON.stringify(event), | |
| credentials: 'same-origin', |
| if (typeof rawTimestamp === 'number') { | ||
| timestamp = new Date(rawTimestamp).toISOString() | ||
| } else if (typeof rawTimestamp === 'string') { |
There was a problem hiding this comment.
The timestamp validation accepts numeric timestamps and converts them to ISO strings, but doesn't validate if the timestamp value is reasonable. Extremely large or negative numbers could result in invalid dates like "Invalid Date" or dates far in the future/past. Consider adding bounds checking to ensure timestamps are within a reasonable range (e.g., not before 2000 or more than 1 day in the future).
| await fetch(transportEndpoint, { | ||
| method: 'POST', | ||
| headers: { 'Content-Type': 'application/json' }, | ||
| body: JSON.stringify(event), |
There was a problem hiding this comment.
The fetch call doesn't include the keepalive flag. When a page is being unloaded or navigated away from, logs sent at that moment might be cancelled before completion. Adding keepalive: true to the fetch options would ensure that the request continues even if the page is closed, improving reliability of log delivery during page transitions.
| body: JSON.stringify(event), | |
| body: JSON.stringify(event), | |
| keepalive: true, |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request introduces client-to-server log transport support, enabling browser logs to be sent to the server for centralized logging.
The main changes include new configuration options, server route handling for log ingestion, and updates to the client and server code to support this feature.