-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: initial commit of Snapshot middleware #219
Conversation
## Walkthrough
This commit introduces a new Snapshot middleware project, including configuration files, custom error handling, utility functions, and integration with external services like Rollbar. It provides functionality for processing and forwarding requests, handling retries on errors, and logging. Initial tests and documentation are also included to support deployment and development.
## Changes
| Files | Summary |
|--------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `.editorconfig`, `.gitignore` | Initial commit of configuration files to maintain consistent coding styles and ignore unnecessary files in the repository. |
| `README.md` | Instructions for deploying and developing the Snapshot middleware locally, detailing setup steps and testing procedures. |
| `src/exceptions.js`, `src/utils.js` | Introduction of custom error classes and a utility function for making HTTP requests with retry logic on specific errors. |
| `src/index.js` | New middleware for handling snapshot requests, validating data, and processing messages from a queue. |
| `src/snapshot.js` | Implementation of `SnapshotApi` class for uploading images to an API endpoint using base64 encoding and handling responses. |
| `src/rollbar.js` | Module for logging errors using Rollbar, providing methods to send traces and telemetry data to the Rollbar API. |
| `src/test.js` | Initial commit of a JSON template for sending detailed error or event data to a service like Rollbar. |
| `test/index.spec.js` | Test suite for a Cloudflare worker, verifying basic response functionality. |
> In code we trust, through bytes we sail,
> A middleware tale where errors pale.
> With Rollbar's watchful eye, logs take flight,
> As snapshots dance in the digital night.
> Retry, resolve, in harmony they sing,
> A rabbit's joy in every spring! 🐇✨ Uplevel your code reviews with CodeRabbit ProCodeRabbit ProIf you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Files selected (11)
- snapshot-middleware/.editorconfig (1)
- snapshot-middleware/.gitignore (1)
- snapshot-middleware/README.md (1)
- snapshot-middleware/src/exceptions.js (1)
- snapshot-middleware/src/index.js (1)
- snapshot-middleware/src/rollbar.js (1)
- snapshot-middleware/src/snapshot.js (1)
- snapshot-middleware/src/test.js (1)
- snapshot-middleware/src/utils.js (1)
- snapshot-middleware/test/index.spec.js (1)
- snapshot-middleware/vitest.config.js (1)
Files ignored due to filter (4)
- snapshot-middleware/package-lock.json
- snapshot-middleware/package.json
- snapshot-middleware/rollbar.toml
- snapshot-middleware/wrangler.toml
Files skipped from review due to trivial changes (3)
- snapshot-middleware/.editorconfig
- snapshot-middleware/.gitignore
- snapshot-middleware/src/test.js (diff too large)
Review comments generated (19)
- Review: 7
- LGTM: 12
Tips
Chat with CodeRabbit Bot (@coderabbitai
)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@coderabbitai
in a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@coderabbitai: ignore
anywhere in the PR description to pause further reviews from the bot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Files selected (4)
- snapshot-middleware/src/index.js (1)
- snapshot-middleware/src/rollbar.js (1)
- snapshot-middleware/src/snapshot.js (1)
- snapshot-middleware/test/index.spec.js (1)
Review comments generated (14)
- Review: 5
- LGTM: 9
Tips
Chat with CodeRabbit Bot (@coderabbitai
)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@coderabbitai
in a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@coderabbitai: ignore
anywhere in the PR description to pause further reviews from the bot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Files selected (10)
- snapshot-middleware/.editorconfig (1)
- snapshot-middleware/.gitignore (1)
- snapshot-middleware/README.md (1)
- snapshot-middleware/src/exceptions.js (1)
- snapshot-middleware/src/index.js (1)
- snapshot-middleware/src/rollbar.js (1)
- snapshot-middleware/src/snapshot.js (1)
- snapshot-middleware/src/utils.js (1)
- snapshot-middleware/test/index.spec.js (1)
- snapshot-middleware/vitest.config.js (1)
Files ignored due to filter (4)
- snapshot-middleware/package-lock.json
- snapshot-middleware/package.json
- snapshot-middleware/rollbar.toml
- snapshot-middleware/wrangler.toml
Files skipped from review due to trivial changes (2)
- snapshot-middleware/.editorconfig
- snapshot-middleware/.gitignore
Review comments generated (26)
- Review: 8
- LGTM: 18
Tips
Chat with CodeRabbit Bot (@coderabbitai
)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@coderabbitai
in a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@coderabbitai: ignore
anywhere in the PR description to pause further reviews from the bot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Files selected (3)
- .github/workflows/code-review.yml (1)
- snapshot-middleware/src/index.js (1)
- snapshot-middleware/src/rollbar.js (1)
Review comments generated (5)
- Review: 3
- LGTM: 2
Tips
Chat with CodeRabbit Bot (@coderabbitai
)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@coderabbitai
in a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@coderabbitai: ignore
anywhere in the PR description to pause further reviews from the bot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Files selected (1)
- snapshot-middleware/README.md (1)
Files ignored due to filter (2)
- snapshot-middleware/rollbar.toml
- snapshot-middleware/wrangler.toml
Review comments generated (1)
- Review: 0
- LGTM: 1
Tips
Chat with CodeRabbit Bot (@coderabbitai
)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@coderabbitai
in a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@coderabbitai: ignore
anywhere in the PR description to pause further reviews from the bot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good but I can't test. Left comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
nit: could you use 2 or 4 spaces for indentation?
@danleyb2 Don't hesitate to install and use Prettier and eslint for JS/TS. |
improve rollbar parsing of exceptions messages
@danleyb2 |
Summary by CodeRabbit
.editorconfig
and.gitignore
for consistent coding style and repository cleanliness.