Skip to content

chore: add logger to track response schema when non 2xx response came…#5038

Merged
ItsSudip merged 2 commits intohotfix/16hMar2026from
fix/fblaHydration
Mar 16, 2026
Merged

chore: add logger to track response schema when non 2xx response came…#5038
ItsSudip merged 2 commits intohotfix/16hMar2026from
fix/fblaHydration

Conversation

@ItsSudip
Copy link
Member

@ItsSudip ItsSudip commented Mar 13, 2026

What are the changes introduced in this PR?

We are getting some unexpected errors, so adding a logger to verify why those error might happen. Along with that, we are considering all 2xx as a success scenario as we can't consider them as failures.

What is the related Linear task?

Resolves INT-6069

Please explain the objectives of your changes below

Put down any required details on the broader aspect of your changes. If there are any dependent changes, mandatorily mention them here

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

N/A

Any new dependencies introduced with this change?

N/A

Any new generic utility introduced or modified. Please explain the changes.

N/A

Any technical or performance related pointers to consider with the change?

N/A

@coderabbitai review


Developer checklist

  • My code follows the style guidelines of this project

  • No breaking changes are being introduced.

  • All related docs linked with the PR?

  • All changes manually tested?

  • Any documentation changes needed with this change?

  • Is the PR limited to 10 file changes?

  • Is the PR limited to one linear task?

  • Are relevant unit and component test-cases added in new readability format?

Reviewer checklist

  • Is the type of change in the PR title appropriate as per the changes?

  • Verified that there are no credentials or confidential data exposed with the changes.

… without any error

🔒 Scanned for secrets using gitleaks 8.28.0
@ItsSudip ItsSudip requested a review from a team as a code owner March 13, 2026 07:31
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 13, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c983b2a4-084c-4c68-a009-c27e674575f8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'auto_resolve_threads'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/fblaHydration
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use oxc to improve the quality of JavaScript and TypeScript code reviews.

Add a configuration file to your project to customize how CodeRabbit runs oxc.

@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.27%. Comparing base (d281d8f) to head (593aefa).
⚠️ Report is 2 commits behind head on hotfix/16hMar2026.

Additional details and impacted files
@@                  Coverage Diff                  @@
##           hotfix/16hMar2026    #5038      +/-   ##
=====================================================
- Coverage              92.32%   92.27%   -0.05%     
=====================================================
  Files                    657      656       -1     
  Lines                  36139    35904     -235     
  Branches                8531     8467      -64     
=====================================================
- Hits                   33365    33131     -234     
+ Misses                  2557     2535      -22     
- Partials                 217      238      +21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

const processedResponse = processAxiosResponse(clientResponse);

if (processedResponse.status === HTTP_STATUS_CODES.OK) {
if (isHttpStatusSuccess(processedResponse.status)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? For all 2xx, we are considering success. Don't see anything related to it in PR description.

function isHttpStatusSuccess(status) {
  return status >= 200 && status < 300;
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the pr description. We shouldn't only consider the 200 as success. We should apply any 2xx as a success scenario. Otherwise, any response that is non-200 but a 2xx, we will apply the error handler on the response, which is not intended.

}
throw new Error(`Unexpected: unknown error type ${error}`);
}
logger.error(`[facebook_lead_ads_native] Non-OK response from Facebook API`, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure, we are not going to get anything sensitive in response?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we are just logging the schema of the object along with the status code.

}
logger.error(`[facebook_lead_ads_native] Non-OK response from Facebook API`, {
status: processedResponse.status,
response: JSON.stringify(JsonSchemaGenerator.generate(processedResponse.response)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's JsonSchemaGenerator? Why do we need it? Can't we simply stringify it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JsonSchemaGenerator will generate the schema of the response object. We are using the same approach in source transformation error handling as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets log the schema of processedResponse. There might be other fields

@sonarqubecloud
Copy link

@ItsSudip ItsSudip changed the base branch from main to hotfix/16hMar2026 March 16, 2026 04:19
@ItsSudip ItsSudip merged commit af30c70 into hotfix/16hMar2026 Mar 16, 2026
39 checks passed
@ItsSudip ItsSudip deleted the fix/fblaHydration branch March 16, 2026 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants