Feat/staging anchr setup#254
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThis change updates the webhook handling logic in two controller files to modify the URL construction for outgoing POST requests to the Anchr server. Instead of using environment variables for the path, the controllers now use hardcoded string segments. Additionally, the return statements for these POST requests were removed. One configuration file was reformatted for consistency. Changes
Sequence Diagram(s)sequenceDiagram
participant ExternalService as External Service
participant WebhookController as WebhookController
participant AnchrServer as Anchr Server
ExternalService->>WebhookController: Sends webhook event
WebhookController->>AnchrServer: POST /blabsy or /pictique (base: ANCHR_URL)
Note right of WebhookController: No early return after POST
Assessment against linked issues
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (19)
infrastructure/eid-wallet/src-tauri/gen/android/.idea/.gitignoreis excluded by!**/gen/**infrastructure/eid-wallet/src-tauri/gen/android/.idea/AndroidProjectSystem.xmlis excluded by!**/gen/**infrastructure/eid-wallet/src-tauri/gen/android/.idea/appInsightsSettings.xmlis excluded by!**/gen/**infrastructure/eid-wallet/src-tauri/gen/android/.idea/compiler.xmlis excluded by!**/gen/**infrastructure/eid-wallet/src-tauri/gen/android/.idea/deploymentTargetSelector.xmlis excluded by!**/gen/**infrastructure/eid-wallet/src-tauri/gen/android/.idea/deviceManager.xmlis excluded by!**/gen/**infrastructure/eid-wallet/src-tauri/gen/android/.idea/gradle.xmlis excluded by!**/gen/**infrastructure/eid-wallet/src-tauri/gen/android/.idea/kotlinc.xmlis excluded by!**/gen/**infrastructure/eid-wallet/src-tauri/gen/android/.idea/migrations.xmlis excluded by!**/gen/**infrastructure/eid-wallet/src-tauri/gen/android/.idea/misc.xmlis excluded by!**/gen/**infrastructure/eid-wallet/src-tauri/gen/android/.idea/runConfigurations.xmlis excluded by!**/gen/**infrastructure/eid-wallet/src-tauri/gen/android/.idea/vcs.xmlis excluded by!**/gen/**infrastructure/eid-wallet/src-tauri/gen/android/app/build.gradle.ktsis excluded by!**/gen/**infrastructure/eid-wallet/src-tauri/gen/android/app/src/main/java/com/eid_wallet/app/MainActivity.ktis excluded by!**/gen/**infrastructure/eid-wallet/src-tauri/gen/android/buildSrc/src/main/java/com/eid_wallet/app/kotlin/BuildTask.ktis excluded by!**/gen/**infrastructure/eid-wallet/src-tauri/gen/android/buildSrc/src/main/java/com/eid_wallet/app/kotlin/RustPlugin.ktis excluded by!**/gen/**pglite-debug.logis excluded by!**/*.logplatforms/blabsy/pglite-debug.logis excluded by!**/*.logpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (7)
.gitignore(1 hunks)infrastructure/eid-wallet/vite.config.js(1 hunks)platforms/blabsy-w3ds-auth-api/src/controllers/WebhookController.ts(4 hunks)platforms/blabsy/.env.development(0 hunks)platforms/pictique-api/src/controllers/WebhookController.ts(2 hunks)platforms/pictique-api/src/web3adapter/controllers/WebhookController.ts(0 hunks)platforms/pictique/vite.config.ts(1 hunks)
💤 Files with no reviewable changes (2)
- platforms/blabsy/.env.development
- platforms/pictique-api/src/web3adapter/controllers/WebhookController.ts
🔇 Additional comments (6)
.gitignore (1)
8-9: LGTM! Good security practice.Adding
.env.developmentto.gitignoreis the correct approach to prevent sensitive environment variables from being committed to version control.infrastructure/eid-wallet/vite.config.js (1)
9-31: LGTM! Formatting improvements.The changes consist of formatting and indentation improvements with no functional modifications. The configuration remains functionally identical.
platforms/pictique/vite.config.ts (1)
8-13: LGTM! Proper multi-environment configuration.The addition of staging and production domains to
allowedHostsfollows a consistent naming pattern and properly supports multi-environment deployment.platforms/pictique-api/src/controllers/WebhookController.ts (1)
11-11: LGTM! Proper import addition.The axios import is correctly added for HTTP request functionality.
platforms/blabsy-w3ds-auth-api/src/controllers/WebhookController.ts (2)
7-7: LGTM! Proper import addition.The axios import is correctly added for HTTP request functionality.
254-262: LGTM! Formatting improvements.The formatting changes in the mapping methods improve code readability without affecting functionality.
Also applies to: 285-289
| if (process.env.ANCHR_URL) { | ||
| return axios.post(new URL(process.env.ANCHR_URL, process.env.PUBLIC_PICTIQUE_BASE_URL).toString(), req.body) | ||
| axios.post(new URL("blabsy", process.env.ANCHR_URL).toString(), req.body) | ||
| } |
There was a problem hiding this comment.
Add error handling for webhook forwarding.
The axios POST request lacks error handling and is not awaited, which could lead to silent failures in cross-platform webhook forwarding.
- if (process.env.ANCHR_URL) {
- axios.post(new URL("blabsy", process.env.ANCHR_URL).toString(), req.body)
- }
+ if (process.env.ANCHR_URL) {
+ try {
+ await axios.post(new URL("blabsy", process.env.ANCHR_URL).toString(), req.body);
+ } catch (error) {
+ console.error("Failed to forward webhook to blabsy:", error);
+ // Continue processing despite forwarding failure
+ }
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (process.env.ANCHR_URL) { | |
| return axios.post(new URL(process.env.ANCHR_URL, process.env.PUBLIC_PICTIQUE_BASE_URL).toString(), req.body) | |
| axios.post(new URL("blabsy", process.env.ANCHR_URL).toString(), req.body) | |
| } | |
| if (process.env.ANCHR_URL) { | |
| try { | |
| await axios.post( | |
| new URL("blabsy", process.env.ANCHR_URL).toString(), | |
| req.body | |
| ); | |
| } catch (error) { | |
| console.error("Failed to forward webhook to blabsy:", error); | |
| // Continue processing despite forwarding failure | |
| } | |
| } |
🤖 Prompt for AI Agents
In platforms/pictique-api/src/controllers/WebhookController.ts around lines 32
to 34, the axios POST request for webhook forwarding is neither awaited nor
wrapped in error handling, risking silent failures. Modify the code to await the
axios.post call and add a try-catch block to catch and log any errors during the
request, ensuring failures are properly handled and visible.
| if (process.env.ANCHR_URL) { | ||
| return axios.post(new URL(process.env.ANCHR_URL, process.env.PUBLIC_BLABSY_BASE_URL).toString(), req.body) | ||
| axios.post(new URL("pictique", process.env.ANCHR_URL).toString(), req.body) | ||
| } |
There was a problem hiding this comment.
Add error handling for webhook forwarding.
The axios POST request lacks error handling and is not awaited, which could lead to silent failures in cross-platform webhook forwarding.
- if (process.env.ANCHR_URL) {
- axios.post(new URL("pictique", process.env.ANCHR_URL).toString(), req.body)
- }
+ if (process.env.ANCHR_URL) {
+ try {
+ await axios.post(new URL("pictique", process.env.ANCHR_URL).toString(), req.body);
+ } catch (error) {
+ console.error("Failed to forward webhook to pictique:", error);
+ // Continue processing despite forwarding failure
+ }
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (process.env.ANCHR_URL) { | |
| return axios.post(new URL(process.env.ANCHR_URL, process.env.PUBLIC_BLABSY_BASE_URL).toString(), req.body) | |
| axios.post(new URL("pictique", process.env.ANCHR_URL).toString(), req.body) | |
| } | |
| if (process.env.ANCHR_URL) { | |
| try { | |
| await axios.post( | |
| new URL("pictique", process.env.ANCHR_URL).toString(), | |
| req.body | |
| ); | |
| } catch (error) { | |
| console.error("Failed to forward webhook to pictique:", error); | |
| // Continue processing despite forwarding failure | |
| } | |
| } |
🤖 Prompt for AI Agents
In platforms/blabsy-w3ds-auth-api/src/controllers/WebhookController.ts around
lines 90 to 92, the axios POST request to forward the webhook is neither awaited
nor wrapped in error handling, risking silent failures. Modify the code to await
the axios.post call and add a try-catch block to catch and log any errors that
occur during the request, ensuring failures are detected and handled properly.
* chore: remove file * chore: add things to gitignore * chore: add debug hosts * chore: fix wrong endpoints
Description of change
Issue Number
closes #252
Type of change
How the change has been tested
Change checklist
Summary by CodeRabbit
Bug Fixes
Style