Skip to content

[Messaging logs] Better logging AggregateError #12801

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

Merged
merged 1 commit into from
Jun 23, 2025

Conversation

guillim
Copy link
Contributor

@guillim guillim commented Jun 23, 2025

"An AggregateError in NestJS usually indicates that multiple errors were thrown or collected together and then re-thrown as a single error."

Since we have this in logs, we cannot debug properly the error #12589
Screenshot 2025-06-23 at 18 39 16

That is why we will better log this errors in order to tackle them ASAP

Note: sentry errors match our Grafan logs agggregate errors as you can see

Screenshot 2025-06-23 at 18 39 58 Screenshot 2025-06-23 at 18 40 46

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Enhanced error logging for AggregateError instances in token refresh operations to improve debugging capabilities.

  • Added detailed AggregateError logging in packages/twenty-server/src/modules/connected-account/refresh-tokens-manager/services/connected-account-refresh-tokens.service.ts to capture error message, name, and individual errors array
  • Improved error traceability for issue #12589 by providing granular error information in catch blocks
  • Maintained existing error handling logic while adding better visibility into token refresh failures

1 file reviewed, 1 comment
Edit PR Review Bot Settings | Greptile

this.logger.log(error?.errors);
} else {
this.logger.log(error);
}
throw new ConnectedAccountRefreshAccessTokenException(
`Error refreshing tokens for connected account ${connectedAccount.id.slice(0, 7)} in workspace ${workspaceId.slice(0, 7)}: ${error.message} ${error?.response?.data?.error_description}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider including error.errors in the exception message for AggregateError to preserve the detailed error information

@guillim guillim self-assigned this Jun 23, 2025
@guillim guillim changed the title Better logging AggregateError for later debugging [Messaging logs] Better logging AggregateError for later debugging Jun 23, 2025
@guillim guillim changed the title [Messaging logs] Better logging AggregateError for later debugging [Messaging logs] Better logging AggregateError Jun 23, 2025
@guillim guillim requested a review from bosiraphael June 23, 2025 16:41
@guillim guillim enabled auto-merge (squash) June 23, 2025 16:42
Copy link
Contributor

@bosiraphael bosiraphael left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

📊 API Changes Report

REST API Changes

Summary

🔄 Changed Operations (63)

  • /apiKeys/duplicates: Modified operation
  • /attachments/duplicates: Modified operation
  • /blocklists/duplicates: Modified operation
  • /calendarChannelEventAssociations/duplicates: Modified operation
  • /calendarChannels/duplicates: Modified operation
  • /calendarEventParticipants/duplicates: Modified operation
  • /calendarEvents/duplicates: Modified operation
  • /companies/duplicates: Modified operation
  • /connectedAccounts/duplicates: Modified operation
  • /favoriteFolders/duplicates: Modified operation
  • /favorites/duplicates: Modified operation
  • /messageChannelMessageAssociations/duplicates: Modified operation
  • /messageChannels/duplicates: Modified operation
  • /messageFolders/duplicates: Modified operation
  • /messageParticipants/duplicates: Modified operation
  • /messages/duplicates: Modified operation
  • /messageThreads/duplicates: Modified operation
  • /notes/duplicates: Modified operation
  • /noteTargets/duplicates: Modified operation
  • /opportunities/duplicates: Modified operation
  • /people/duplicates: Modified operation
  • /pets/duplicates: Modified operation
  • /rockets/duplicates: Modified operation
  • /surveyResults/duplicates: Modified operation
  • /tasks/duplicates: Modified operation
  • /taskTargets/duplicates: Modified operation
  • /timelineActivities/duplicates: Modified operation
  • /viewFields/duplicates: Modified operation
  • /viewFilterGroups/duplicates: Modified operation
  • /viewFilters/duplicates: Modified operation
  • /viewGroups/duplicates: Modified operation
  • /views/duplicates: Modified operation
  • /viewSorts/duplicates: Modified operation
  • /webhooks/duplicates: Modified operation
  • /workflowAutomatedTriggers/duplicates: Modified operation
  • /workflowRuns/duplicates: Modified operation
  • /workflows/duplicates: Modified operation
  • /workflowVersions/duplicates: Modified operation
  • /workspaceMembers/duplicates: Modified operation
  • /apiKeys: Modified operation
  • /apiKeys/{id}: Modified operation
  • /calendarEvents: Modified operation
  • /calendarEvents/{id}: Modified operation
  • /companies: Modified operation
  • /companies/{id}: Modified operation
  • /opportunities: Modified operation
  • /opportunities/{id}: Modified operation
  • /people: Modified operation
  • /people/{id}: Modified operation
  • /pets: Modified operation
  • /pets/{id}: Modified operation
  • /viewFields: Modified operation
  • /viewFields/{id}: Modified operation
  • /viewFilters: Modified operation
  • /viewFilters/{id}: Modified operation
  • /viewGroups: Modified operation
  • /viewGroups/{id}: Modified operation
  • /views: Modified operation
  • /views/{id}: Modified operation
  • /viewSorts: Modified operation
  • /viewSorts/{id}: Modified operation
  • /workspaceMembers: Modified operation
  • /workspaceMembers/{id}: Modified operation

⚠️ Please review these API changes carefully before merging.

⚠️ Breaking Change Protocol

Breaking changes detected but PR title does not contain "breaking" - CI will pass but action needed.

🔄 Options:

  1. If this IS a breaking change: Add "breaking" to your PR title and add BREAKING CHANGE: to your commit message
  2. If this is NOT a breaking change: The API diff tool may have false positives - please review carefully

For breaking changes, add to commit message:

feat: add new API endpoint

BREAKING CHANGE: removed deprecated field from User schema

Copy link
Contributor

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:40852

This environment will automatically shut down when the PR is closed or after 5 hours.

@guillim guillim merged commit 26d8498 into main Jun 23, 2025
43 of 48 checks passed
@guillim guillim deleted the Better-logging-AggregateError branch June 23, 2025 16:53
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.

2 participants